forked from microsoft/GSL
Restricting usage of owner<T> to pointer types (#507)
* Restricting usage of owner<T> to pointer types * Removing an additional type that was created for testing * Added comment about the new constraint on owner * Adding dereference operator to not_null * Removing dereference operator changes for not-null * Removing dereference operator changes for not-null * Review comments
This commit is contained in:
committed by
Neil MacIntosh
parent
23581d4d63
commit
30595c1f1d
@@ -20,6 +20,8 @@
|
||||
|
||||
#include <functional>
|
||||
|
||||
#include <memory>
|
||||
|
||||
using namespace gsl;
|
||||
|
||||
SUITE(owner_tests)
|
||||
@@ -34,6 +36,16 @@ SUITE(owner_tests)
|
||||
CHECK(*p == 121);
|
||||
delete p;
|
||||
}
|
||||
|
||||
TEST(check_pointer_constraint)
|
||||
{
|
||||
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||
{
|
||||
owner<int> integerTest = 10;
|
||||
owner<std::shared_ptr<int>> sharedPtrTest(new int(10));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
int main(int, const char* []) { return UnitTest::RunAllTests(); }
|
||||
|
||||
Reference in New Issue
Block a user