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:
saurabh singh
2017-05-30 20:08:12 -07:00
committed by Neil MacIntosh
parent 23581d4d63
commit 30595c1f1d
2 changed files with 23 additions and 1 deletions
+12
View File
@@ -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(); }