diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-09-23 19:49:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-09-26 13:03:46 (GMT) |
commit | 67480c05e3f6819d867680775ca0cbc6f03f28da (patch) | |
tree | 11c0b70f42dcb6d936bb7d47766747af49f7e28b /Source/Checks/cm_cxx_auto_ptr.cxx | |
parent | 6757e6608992354300d635a96fed29800a4856c3 (diff) | |
download | CMake-67480c05e3f6819d867680775ca0cbc6f03f28da.zip CMake-67480c05e3f6819d867680775ca0cbc6f03f28da.tar.gz CMake-67480c05e3f6819d867680775ca0cbc6f03f28da.tar.bz2 |
Add a feature check to test availability of auto_ptr
Diffstat (limited to 'Source/Checks/cm_cxx_auto_ptr.cxx')
-rw-r--r-- | Source/Checks/cm_cxx_auto_ptr.cxx | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Source/Checks/cm_cxx_auto_ptr.cxx b/Source/Checks/cm_cxx_auto_ptr.cxx new file mode 100644 index 0000000..d3100fd --- /dev/null +++ b/Source/Checks/cm_cxx_auto_ptr.cxx @@ -0,0 +1,18 @@ +#include <memory> + +std::auto_ptr<int> get_auto_ptr() +{ + std::auto_ptr<int> ptr; + ptr = std::auto_ptr<int>(new int(0)); + return ptr; +} + +int use_auto_ptr(std::auto_ptr<int> ptr) +{ + return *ptr; +} + +int main() +{ + return use_auto_ptr(get_auto_ptr()); +} |