
I am working on bugs in boost phoenix. I have found some problems eg. #7624 which run fine with C++11 with either Clang 3.4 or gcc 4.8.2. I also have a patch which has been suggested for bug #8704 which uses C++11. Is there a way to incorporate C++11 only code into tests or the actual headers. If so, is there an example of how to do it in Boost? Thank you John Fletcher

On Sat, Feb 1, 2014 at 4:35 PM, Fletcher, John P
Is there a way to incorporate C++11 only code into tests or the actual headers.
If so, is there an example of how to do it in Boost?
This is what I do it in Boost.Smart_Ptr tests around C++11 only features: https://github.com/boostorg/smart_ptr/blob/develop/test/make_unique_args_tes... e.g. Any tests relating to std::unique_ptr features are entirely enabled only when BOOST_NO_CXX11_SMART_PTR is not defined. Any specific test cases within that code are enabled only when certain C++11 features are present; e.g. if BOOST_NO_CXX11_VARIADIC_TEMPLATES is not defined. Glen

On 02/02/14 01:35, Fletcher, John P wrote:
I am working on bugs in boost phoenix.
I have found some problems eg. #7624 which run fine with C++11 with either Clang 3.4 or gcc 4.8.2.
I also have a patch which has been suggested for bug #8704 which uses C++11.
Is there a way to incorporate C++11 only code into tests or the actual headers.
If so, is there an example of how to do it in Boost?
Boost.Config defines many macros to test whether some C++03 or C++11 features are available. Try to use those as much as possible instead of doing your own compiler detection logic. http://www.boost.org/doc/libs/release/libs/config/doc/html/index.html

________________________________________ From: Boost [boost-bounces@lists.boost.org] on behalf of Mathias Gaunard [mathias.gaunard@ens-lyon.org] Sent: 02 February 2014 11:17 To: boost@lists.boost.org Subject: Re: [boost] [C++11] Is conditional code allowed? On 02/02/14 01:35, Fletcher, John P wrote:
Is there a way to incorporate C++11 only code into tests or the actual headers.
If so, is there an example of how to do it in Boost?
Boost.Config defines many macros to test whether some C++03 or C++11 features are available. Try to use those as much as possible instead of doing your own compiler detection logic.
http://www.boost.org/doc/libs/release/libs/config/doc/html/index.html
Mathias Thank you, I have selected the following which seems appropriate for my cases. #ifndef BOOST_NO_CXX11_DECLTYPE // C++11 version #else // C++03 workaround if available. #endif I am going to post a test using this to develop. John
participants (3)
-
Fletcher, John P
-
Glen Fernandes
-
Mathias Gaunard