I have some tests which are throwing up std::auto_ptr as deprecated with C++11. Is there a define that can be tested for in user code so that I can switch to std::unique_ptr when it is available? Something like this: #ifdef BOOST_NO_CXX11_UNIQUEPTR // use auto_ptr #else // use unique_ptr #endif Is there a general flag for C++11 or C++14 or is it all done on particular features? Thanks John
On Tue, Dec 30, 2014 at 7:31 AM, Fletcher, John P
I have some tests which are throwing up std::auto_ptr as deprecated with C++11.
Is there a define that can be tested for in user code so that I can switch to std::unique_ptr when it is available? Something like this:
#ifdef BOOST_NO_CXX11_UNIQUEPTR // use auto_ptr #else // use unique_ptr #endif
Is there a general flag for C++11 or C++14 or is it all done on particular features?
__cplusplus may be helpful. Look at regression tests www.boost.org/development/tests/develop/developer/config.html config_info to see how it is defined for various compilers. HTH --Beman
________________________________________
From: Boost [boost-bounces@lists.boost.org] on behalf of Beman Dawes [bdawes@acm.org]
Sent: 30 December 2014 12:40
To: Boost Developers List
Subject: Re: [boost] Define to test for deprecated std::auto_ptr
On Tue, Dec 30, 2014 at 7:31 AM, Fletcher, John P
I have some tests which are throwing up std::auto_ptr as deprecated with C++11.
Is there a define that can be tested for in user code so that I can switch to std::unique_ptr when it is available? Something like this:
#ifdef BOOST_NO_CXX11_UNIQUEPTR // use auto_ptr #else // use unique_ptr #endif
Is there a general flag for C++11 or C++14 or is it all done on particular features?
__cplusplus may be helpful. Look at regression tests www.boost.org/development/tests/develop/developer/config.html config_info to see how it is defined for various compilers.
HTH
--Beman
I have found a test. It is BOOST_NO_CXX11_SMART_PTR and it is set by the standard library in use. On test at the moment. Thanks John
El 30/12/2014 a las 13:31, Fletcher, John P escribió:
I have some tests which are throwing up std::auto_ptr as deprecated with C++11.
Is there a define that can be tested for in user code so that I can switch to std::unique_ptr when it is available? Something like this:
#ifdef BOOST_NO_CXX11_UNIQUEPTR // use auto_ptr #else // use unique_ptr #endif
Or you might want to use boost::movelib::unique_ptr for code to be compiled in C++03 and C++11 modes: http://www.boost.org/doc/libs/1_57_0/doc/html/boost/movelib/unique_ptr.html Best, Ion
________________________________________ From: Boost [boost-bounces@lists.boost.org] on behalf of Ion Gaztañaga [igaztanaga@gmail.com] Sent: 30 December 2014 16:49 To: boost@lists.boost.org Subject: Re: [boost] Define to test for deprecated std::auto_ptr
El 30/12/2014 a las 13:31, Fletcher, John P escribió:
I have some tests which are throwing up std::auto_ptr as deprecated with C++11.
Is there a define that can be tested for in user code so that I can switch to std::unique_ptr when it is available? >>Something like this:
#ifdef BOOST_NO_CXX11_UNIQUEPTR // use auto_ptr #else // use unique_ptr #endif
Or you might want to use boost::movelib::unique_ptr for code to be compiled in C++03 and C++11 modes:
http://www.boost.org/doc/libs/1_57_0/doc/html/boost/movelib/unique_ptr.html
Best,
Ion
Ion I have tried your suggestion as an option in my file at boost/libs/phoenix/test/operator/member.cpp on develop branch. I can declare a pointer O.K. but the tests fail to compile with gcc 4.9.0 and C++11, which may be my configuration. Thanks John
El 30/12/2014 a las 18:51, Fletcher, John P escribió:
I have tried your suggestion as an option in my file at boost/libs/phoenix/test/operator/member.cpp on develop branch. I can declare a pointer O.K. but the tests fail to compile with gcc 4.9.0 and C++11, which may be my configuration.
Let me know if I can help somehow. Best, Ion
participants (3)
-
Beman Dawes
-
Fletcher, John P
-
Ion Gaztañaga