Skip to content
Snippets Groups Projects
Commit a7218307 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'auto-ptr'

e6380b11 Use std::auto_ptr on compilers that do not warn about it
67480c05 Add a feature check to test availability of auto_ptr
parents 4d6f0a55 e6380b11
Branches
Tags
No related merge requests found
#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());
}
......@@ -32,6 +32,7 @@ function(cm_check_cxx_feature name)
endfunction()
if(CMAKE_CXX_STANDARD)
cm_check_cxx_feature(auto_ptr)
cm_check_cxx_feature(make_unique)
if(CMake_HAVE_CXX_MAKE_UNIQUE)
set(CMake_HAVE_CXX_UNIQUE_PTR 1)
......
......@@ -30,6 +30,7 @@
#cmakedefine CMAKE_USE_MACH_PARSER
#cmakedefine CMAKE_USE_LIBUV
#cmakedefine CMAKE_ENCODING_UTF8
#cmakedefine CMake_HAVE_CXX_AUTO_PTR
#cmakedefine CMake_HAVE_CXX_MAKE_UNIQUE
#cmakedefine CMake_HAVE_CXX_NULLPTR
#cmakedefine CMake_HAVE_CXX_OVERRIDE
......
......@@ -14,7 +14,13 @@
#include <cmConfigure.h>
// FIXME: Use std::auto_ptr on compilers that do not warn about it.
#ifdef CMake_HAVE_CXX_AUTO_PTR
#include <memory>
#define CM_AUTO_PTR std::auto_ptr
#else
#define CM_AUTO_PTR cm::auto_ptr
// The HP compiler cannot handle the conversions necessary to use
......@@ -219,3 +225,5 @@ public:
#endif
#endif
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment