diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:41:18 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-06 10:43:11 +0900 |
commit | f763a99a501650eff2c60288aa6f10ef916d769e (patch) | |
tree | 02af7e13f9a38c888ebf340fe764cbe7dae99da9 /boost/variant | |
parent | 5cde13f21d36c7224b0e13d11c4b49379ae5210d (diff) | |
download | boost-f763a99a501650eff2c60288aa6f10ef916d769e.tar.gz boost-f763a99a501650eff2c60288aa6f10ef916d769e.tar.bz2 boost-f763a99a501650eff2c60288aa6f10ef916d769e.zip |
Imported Upstream version 1.62.0upstream/1.62.0
Change-Id: I9d4c1ddb7b7d8f0069217ecc582700f9fda6dd4c
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/variant')
32 files changed, 461 insertions, 431 deletions
diff --git a/boost/variant/apply_visitor.hpp b/boost/variant/apply_visitor.hpp index 53bada09e9..6ad54fb700 100644 --- a/boost/variant/apply_visitor.hpp +++ b/boost/variant/apply_visitor.hpp @@ -13,8 +13,8 @@ #ifndef BOOST_VARIANT_APPLY_VISITOR_HPP #define BOOST_VARIANT_APPLY_VISITOR_HPP -#include "boost/variant/detail/apply_visitor_unary.hpp" -#include "boost/variant/detail/apply_visitor_binary.hpp" -#include "boost/variant/detail/apply_visitor_delayed.hpp" +#include <boost/variant/detail/apply_visitor_unary.hpp> +#include <boost/variant/detail/apply_visitor_binary.hpp> +#include <boost/variant/detail/apply_visitor_delayed.hpp> #endif // BOOST_VARIANT_APPLY_VISITOR_HPP diff --git a/boost/variant/detail/apply_visitor_binary.hpp b/boost/variant/detail/apply_visitor_binary.hpp index e5e22e1d82..6670cd8d27 100644 --- a/boost/variant/detail/apply_visitor_binary.hpp +++ b/boost/variant/detail/apply_visitor_binary.hpp @@ -13,21 +13,21 @@ #ifndef BOOST_VARIANT_DETAIL_APPLY_VISITOR_BINARY_HPP #define BOOST_VARIANT_DETAIL_APPLY_VISITOR_BINARY_HPP -#include "boost/config.hpp" -#include "boost/detail/workaround.hpp" -#include "boost/variant/detail/generic_result_type.hpp" +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/variant/detail/generic_result_type.hpp> -#include "boost/variant/detail/apply_visitor_unary.hpp" +#include <boost/variant/detail/apply_visitor_unary.hpp> #if BOOST_WORKAROUND(__EDG__, BOOST_TESTED_AT(302)) -#include "boost/utility/enable_if.hpp" -#include "boost/mpl/not.hpp" -#include "boost/type_traits/is_const.hpp" +#include <boost/utility/enable_if.hpp> +#include <boost/mpl/not.hpp> +#include <boost/type_traits/is_const.hpp> #endif #if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) -# include "boost/variant/detail/has_result_type.hpp" +# include <boost/variant/detail/has_result_type.hpp> #endif namespace boost { diff --git a/boost/variant/detail/apply_visitor_delayed.hpp b/boost/variant/detail/apply_visitor_delayed.hpp index 29f46141d8..515a93ef01 100644 --- a/boost/variant/detail/apply_visitor_delayed.hpp +++ b/boost/variant/detail/apply_visitor_delayed.hpp @@ -13,14 +13,14 @@ #ifndef BOOST_VARIANT_DETAIL_APPLY_VISITOR_DELAYED_HPP #define BOOST_VARIANT_DETAIL_APPLY_VISITOR_DELAYED_HPP -#include "boost/variant/detail/generic_result_type.hpp" +#include <boost/variant/detail/generic_result_type.hpp> -#include "boost/variant/detail/apply_visitor_unary.hpp" -#include "boost/variant/detail/apply_visitor_binary.hpp" -#include "boost/variant/variant_fwd.hpp" // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES +#include <boost/variant/detail/apply_visitor_unary.hpp> +#include <boost/variant/detail/apply_visitor_binary.hpp> +#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES -#include "boost/variant/detail/has_result_type.hpp" +#include <boost/variant/detail/has_result_type.hpp> #include <boost/core/enable_if.hpp> namespace boost { diff --git a/boost/variant/detail/apply_visitor_unary.hpp b/boost/variant/detail/apply_visitor_unary.hpp index 63c21a3fea..d4e2c166dc 100644 --- a/boost/variant/detail/apply_visitor_unary.hpp +++ b/boost/variant/detail/apply_visitor_unary.hpp @@ -13,14 +13,14 @@ #ifndef BOOST_VARIANT_DETAIL_APPLY_VISITOR_UNARY_HPP #define BOOST_VARIANT_DETAIL_APPLY_VISITOR_UNARY_HPP -#include "boost/config.hpp" -#include "boost/detail/workaround.hpp" -#include "boost/variant/detail/generic_result_type.hpp" +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/variant/detail/generic_result_type.hpp> #if BOOST_WORKAROUND(__EDG__, BOOST_TESTED_AT(302)) -#include "boost/core/enable_if.hpp" -#include "boost/mpl/not.hpp" -#include "boost/type_traits/is_const.hpp" +#include <boost/core/enable_if.hpp> +#include <boost/mpl/not.hpp> +#include <boost/type_traits/is_const.hpp> #endif #if !defined(BOOST_NO_CXX14_DECLTYPE_AUTO) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) @@ -30,7 +30,7 @@ # include <boost/mpl/size.hpp> # include <boost/utility/declval.hpp> # include <boost/core/enable_if.hpp> -# include "boost/variant/detail/has_result_type.hpp" +# include <boost/variant/detail/has_result_type.hpp> #endif namespace boost { diff --git a/boost/variant/detail/backup_holder.hpp b/boost/variant/detail/backup_holder.hpp index 1ccf160ce7..c11f12cf58 100644 --- a/boost/variant/detail/backup_holder.hpp +++ b/boost/variant/detail/backup_holder.hpp @@ -13,8 +13,8 @@ #ifndef BOOST_VARIANT_DETAIL_BACKUP_HOLDER_HPP #define BOOST_VARIANT_DETAIL_BACKUP_HOLDER_HPP -#include "boost/config.hpp" -#include "boost/assert.hpp" +#include <boost/config.hpp> +#include <boost/assert.hpp> namespace boost { namespace detail { namespace variant { diff --git a/boost/variant/detail/cast_storage.hpp b/boost/variant/detail/cast_storage.hpp index 24feed6bd2..0320278c15 100644 --- a/boost/variant/detail/cast_storage.hpp +++ b/boost/variant/detail/cast_storage.hpp @@ -13,7 +13,7 @@ #ifndef BOOST_VARIANT_DETAIL_CAST_STORAGE_HPP #define BOOST_VARIANT_DETAIL_CAST_STORAGE_HPP -#include "boost/config.hpp" +#include <boost/config.hpp> namespace boost { namespace detail { namespace variant { diff --git a/boost/variant/detail/config.hpp b/boost/variant/detail/config.hpp index 84564a46b1..70725e2cc8 100644 --- a/boost/variant/detail/config.hpp +++ b/boost/variant/detail/config.hpp @@ -3,8 +3,8 @@ // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // -// Copyright (c) 2003 -// Eric Friedman +// Copyright (c) 2003 Eric Friedman +// Copyright (c) 2016 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -13,25 +13,7 @@ #ifndef BOOST_VARIANT_DETAIL_CONFIG_HPP #define BOOST_VARIANT_DETAIL_CONFIG_HPP -#include "boost/config.hpp" -#include "boost/detail/workaround.hpp" - -/////////////////////////////////////////////////////////////////////////////// -// macro BOOST_VARIANT_AUX_BROKEN_CONSTRUCTOR_TEMPLATE_ORDERING -// -#if BOOST_WORKAROUND(__MWERKS__, <= 0x3201) \ - || BOOST_WORKAROUND(BOOST_INTEL, <= 700) \ - && !defined(BOOST_VARIANT_AUX_BROKEN_CONSTRUCTOR_TEMPLATE_ORDERING) -# define BOOST_VARIANT_AUX_BROKEN_CONSTRUCTOR_TEMPLATE_ORDERING -#endif - -/////////////////////////////////////////////////////////////////////////////// -// macro BOOST_VARIANT_AUX_HAS_CONSTRUCTOR_TEMPLATE_ORDERING_SFINAE_WKND -// -#if !defined(BOOST_NO_SFINAE) \ - && !BOOST_WORKAROUND(BOOST_INTEL, <= 700) \ - && !defined(BOOST_VARIANT_AUX_HAS_CONSTRUCTOR_TEMPLATE_ORDERING_SFINAE_WKND) -# define BOOST_VARIANT_AUX_HAS_CONSTRUCTOR_TEMPLATE_ORDERING_SFINAE_WKND -#endif +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> #endif // BOOST_VARIANT_DETAIL_CONFIG_HPP diff --git a/boost/variant/detail/element_index.hpp b/boost/variant/detail/element_index.hpp index 8ea92ecc5e..cc926f6cf8 100644 --- a/boost/variant/detail/element_index.hpp +++ b/boost/variant/detail/element_index.hpp @@ -12,13 +12,13 @@ #ifndef BOOST_VARIANT_DETAIL_ELEMENT_INDEX_HPP #define BOOST_VARIANT_DETAIL_ELEMENT_INDEX_HPP -#include "boost/config.hpp" -#include "boost/variant/recursive_wrapper_fwd.hpp" -#include "boost/variant/variant_fwd.hpp" +#include <boost/config.hpp> +#include <boost/variant/recursive_wrapper_fwd.hpp> +#include <boost/variant/variant_fwd.hpp> -#include "boost/type_traits/remove_cv.hpp" -#include "boost/type_traits/remove_reference.hpp" -#include "boost/mpl/find_if.hpp" +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/mpl/find_if.hpp> namespace boost { namespace detail { namespace variant { diff --git a/boost/variant/detail/enable_recursive.hpp b/boost/variant/detail/enable_recursive.hpp index a974b4f078..757e0df585 100644 --- a/boost/variant/detail/enable_recursive.hpp +++ b/boost/variant/detail/enable_recursive.hpp @@ -13,25 +13,25 @@ #ifndef BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_HPP #define BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_HPP -#include "boost/variant/detail/enable_recursive_fwd.hpp" -#include "boost/variant/variant_fwd.hpp" +#include <boost/variant/detail/enable_recursive_fwd.hpp> +#include <boost/variant/variant_fwd.hpp> #if !defined(BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT) -# include "boost/mpl/apply.hpp" -# include "boost/mpl/eval_if.hpp" -# include "boost/mpl/lambda.hpp" +# include <boost/mpl/apply.hpp> +# include <boost/mpl/eval_if.hpp> +# include <boost/mpl/lambda.hpp> #endif -#include "boost/variant/detail/substitute.hpp" -#include "boost/mpl/aux_/config/ctps.hpp" -#include "boost/mpl/bool_fwd.hpp" -#include "boost/mpl/if.hpp" -#include "boost/mpl/or.hpp" -#include "boost/type_traits/is_pointer.hpp" -#include "boost/type_traits/is_reference.hpp" -#include "boost/type_traits/is_same.hpp" +#include <boost/variant/detail/substitute.hpp> +#include <boost/mpl/aux_/config/ctps.hpp> +#include <boost/mpl/bool_fwd.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/or.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/is_same.hpp> -#include "boost/variant/recursive_wrapper.hpp" +#include <boost/variant/recursive_wrapper.hpp> namespace boost { namespace detail { namespace variant { diff --git a/boost/variant/detail/enable_recursive_fwd.hpp b/boost/variant/detail/enable_recursive_fwd.hpp index 39a6b71463..cac156b156 100644 --- a/boost/variant/detail/enable_recursive_fwd.hpp +++ b/boost/variant/detail/enable_recursive_fwd.hpp @@ -13,11 +13,11 @@ #ifndef BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP #define BOOST_VARIANT_DETAIL_ENABLE_RECURSIVE_FWD_HPP -#include "boost/mpl/aux_/config/ctps.hpp" +#include <boost/mpl/aux_/config/ctps.hpp> -#include "boost/mpl/bool_fwd.hpp" +#include <boost/mpl/bool_fwd.hpp> -# include "boost/mpl/bool.hpp" +# include <boost/mpl/bool.hpp> namespace boost { namespace detail { namespace variant { diff --git a/boost/variant/detail/forced_return.hpp b/boost/variant/detail/forced_return.hpp index 522b796fe0..333393a2ac 100644 --- a/boost/variant/detail/forced_return.hpp +++ b/boost/variant/detail/forced_return.hpp @@ -3,8 +3,8 @@ // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // -// Copyright (c) 2003 -// Eric Friedman +// Copyright (c) 2003 Eric Friedman +// Copyright (c) 2015-2016 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -13,90 +13,52 @@ #ifndef BOOST_VARIANT_DETAIL_FORCED_RETURN_HPP #define BOOST_VARIANT_DETAIL_FORCED_RETURN_HPP -#include "boost/config.hpp" -#include "boost/variant/detail/generic_result_type.hpp" -#include "boost/assert.hpp" +#include <boost/config.hpp> +#include <boost/variant/detail/generic_result_type.hpp> +#include <boost/assert.hpp> +#include <cstdlib> // std::abort -namespace boost { -namespace detail { namespace variant { -/////////////////////////////////////////////////////////////////////////////// -// (detail) function template forced_return -// -// Logical error to permit invocation at runtime, but (artificially) satisfies -// compile-time requirement of returning a result value. -// - -#if !defined(BOOST_MSVC) \ - && !defined(BOOST_NO_VOID_RETURNS) - -// "standard" implementation: - -template <typename T> -inline T forced_return() -{ - // logical error: should never be here! (see above) - BOOST_ASSERT(false); +#ifdef BOOST_MSVC +# pragma warning( push ) +# pragma warning( disable : 4702 ) // unreachable code +#endif - T (*dummy_function_ptr)() = 0; - return dummy_function_ptr(); -} +namespace boost { namespace detail { namespace variant { -template <> -inline void forced_return<void>() -{ - // logical error: should never be here! (see above) - BOOST_ASSERT(false); +BOOST_NORETURN inline void forced_return_no_return() { // fixes `must return a value` warnings + using namespace std; + abort(); // some implementations have no std::abort } -#elif !defined(BOOST_MSVC) -// workaround implementation +/////////////////////////////////////////////////////////////////////////////// +// (detail) function template forced_return // -// TODO: Determine the most efficient way to handle this -- as below? by -// throwing? by recursive call to forced_return itself? etc. +// Logical error to permit invocation at runtime, but (artificially) satisfies +// compile-time requirement of returning a result value. // - template <typename T> -inline +BOOST_NORETURN inline BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) forced_return() { // logical error: should never be here! (see above) BOOST_ASSERT(false); + forced_return_no_return(); + +#ifdef BOOST_NO_NORETURN BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) (*dummy)() = 0; return dummy(); +#endif } -#else // defined(BOOST_MSVC) +}}} // namespace boost::detail::variant -# pragma warning( push ) -# pragma warning( disable : 4702 ) // unreachable code -// msvc-specific implementation -// -// Leverages __declspec(noreturn) for optimized implementation. -// - -__declspec(noreturn) -inline void forced_return_no_return() {}; - -template <typename T> -inline - BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(T) -forced_return() -{ - // logical error: should never be here! (see above) - BOOST_ASSERT(false); - - forced_return_no_return(); -} +#ifdef BOOST_MSVC # pragma warning( pop ) - -#endif // BOOST_MSVC optimization - -}} // namespace detail::variant -} // namespace boost +#endif #endif // BOOST_VARIANT_DETAIL_FORCED_RETURN_HPP diff --git a/boost/variant/detail/generic_result_type.hpp b/boost/variant/detail/generic_result_type.hpp index b3fbb19eeb..8b1289cacc 100644 --- a/boost/variant/detail/generic_result_type.hpp +++ b/boost/variant/detail/generic_result_type.hpp @@ -13,7 +13,7 @@ #ifndef BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP #define BOOST_VARIANT_DETAIL_GENERIC_RESULT_TYPE_HPP -#include "boost/config.hpp" +#include <boost/config.hpp> ////////////////////////////////////////////////////////////////////////// // (workaround) macro BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE diff --git a/boost/variant/detail/has_result_type.hpp b/boost/variant/detail/has_result_type.hpp index 8ec3d361ee..80cd56ab11 100644 --- a/boost/variant/detail/has_result_type.hpp +++ b/boost/variant/detail/has_result_type.hpp @@ -12,8 +12,8 @@ #ifndef BOOST_VARIANT_DETAIL_HAS_RESULT_TYPE_HPP #define BOOST_VARIANT_DETAIL_HAS_RESULT_TYPE_HPP -#include "boost/config.hpp" -#include "boost/type_traits/remove_reference.hpp" +#include <boost/config.hpp> +#include <boost/type_traits/remove_reference.hpp> namespace boost { namespace detail { namespace variant { diff --git a/boost/variant/detail/initializer.hpp b/boost/variant/detail/initializer.hpp index f6f425e9b0..4a54c273c2 100644 --- a/boost/variant/detail/initializer.hpp +++ b/boost/variant/detail/initializer.hpp @@ -15,26 +15,26 @@ #include <new> // for placement new -#include "boost/config.hpp" +#include <boost/config.hpp> -#include "boost/call_traits.hpp" -#include "boost/detail/reference_content.hpp" -#include "boost/variant/recursive_wrapper_fwd.hpp" -#include "boost/variant/detail/move.hpp" +#include <boost/call_traits.hpp> +#include <boost/detail/reference_content.hpp> +#include <boost/variant/recursive_wrapper_fwd.hpp> +#include <boost/variant/detail/move.hpp> #if !defined(BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE) -# include "boost/mpl/aux_/value_wknd.hpp" -# include "boost/mpl/int.hpp" -# include "boost/mpl/iter_fold.hpp" -# include "boost/mpl/next.hpp" -# include "boost/mpl/deref.hpp" -# include "boost/mpl/pair.hpp" -# include "boost/mpl/protect.hpp" +# include <boost/mpl/aux_/value_wknd.hpp> +# include <boost/mpl/int.hpp> +# include <boost/mpl/iter_fold.hpp> +# include <boost/mpl/next.hpp> +# include <boost/mpl/deref.hpp> +# include <boost/mpl/pair.hpp> +# include <boost/mpl/protect.hpp> #else -# include "boost/variant/variant_fwd.hpp" -# include "boost/preprocessor/cat.hpp" -# include "boost/preprocessor/enum.hpp" -# include "boost/preprocessor/repeat.hpp" +# include <boost/variant/variant_fwd.hpp> +# include <boost/preprocessor/cat.hpp> +# include <boost/preprocessor/enum.hpp> +# include <boost/preprocessor/repeat.hpp> #endif namespace boost { @@ -111,7 +111,7 @@ struct make_initializer_node return BOOST_MPL_AUX_VALUE_WKND(index)::value; // which } -#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES static int initialize(void* dest, param2_T operand) { // This assert must newer trigger, because all the reference contents are diff --git a/boost/variant/detail/make_variant_list.hpp b/boost/variant/detail/make_variant_list.hpp index 37d725c0b6..b7a0feffd0 100644 --- a/boost/variant/detail/make_variant_list.hpp +++ b/boost/variant/detail/make_variant_list.hpp @@ -13,11 +13,11 @@ #ifndef BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP #define BOOST_VARIANT_DETAIL_MAKE_VARIANT_LIST_HPP -#include "boost/variant/variant_fwd.hpp" +#include <boost/variant/variant_fwd.hpp> -#include "boost/mpl/list.hpp" -#include "boost/preprocessor/cat.hpp" -#include "boost/preprocessor/enum.hpp" +#include <boost/mpl/list.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/enum.hpp> namespace boost { namespace detail { namespace variant { diff --git a/boost/variant/detail/move.hpp b/boost/variant/detail/move.hpp index 0b12adf1ae..8900055b75 100644 --- a/boost/variant/detail/move.hpp +++ b/boost/variant/detail/move.hpp @@ -23,10 +23,10 @@ #include <iterator> // for iterator_traits #include <new> // for placement new -#include "boost/config.hpp" -#include "boost/detail/workaround.hpp" -#include "boost/move/move.hpp" -#include "boost/move/adl_move_swap.hpp" +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/move/move.hpp> +#include <boost/move/adl_move_swap.hpp> namespace boost { namespace detail { namespace variant { diff --git a/boost/variant/detail/multivisitors_cpp11_based.hpp b/boost/variant/detail/multivisitors_cpp11_based.hpp index 370db83660..f9286b7dfd 100644 --- a/boost/variant/detail/multivisitors_cpp11_based.hpp +++ b/boost/variant/detail/multivisitors_cpp11_based.hpp @@ -17,7 +17,7 @@ #endif #include <boost/variant/detail/apply_visitor_unary.hpp> -#include "boost/variant/variant_fwd.hpp" // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES +#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES #if defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) || defined(BOOST_NO_CXX11_HDR_TUPLE) # error "This file requires <tuple> and variadic templates support" diff --git a/boost/variant/detail/over_sequence.hpp b/boost/variant/detail/over_sequence.hpp index ff20a010c7..48394f072d 100644 --- a/boost/variant/detail/over_sequence.hpp +++ b/boost/variant/detail/over_sequence.hpp @@ -15,7 +15,7 @@ #ifndef BOOST_VARIANT_DETAIL_OVER_SEQUENCE_HPP #define BOOST_VARIANT_DETAIL_OVER_SEQUENCE_HPP -#include "boost/mpl/aux_/config/ctps.hpp" +#include <boost/mpl/aux_/config/ctps.hpp> namespace boost { diff --git a/boost/variant/detail/substitute.hpp b/boost/variant/detail/substitute.hpp index d82720e464..2579eb51bb 100644 --- a/boost/variant/detail/substitute.hpp +++ b/boost/variant/detail/substitute.hpp @@ -18,19 +18,19 @@ #ifndef BOOST_VARIANT_DETAIL_SUBSTITUTE_HPP #define BOOST_VARIANT_DETAIL_SUBSTITUTE_HPP -#include "boost/mpl/aux_/config/ctps.hpp" - -#include "boost/variant/detail/substitute_fwd.hpp" -#include "boost/variant/variant_fwd.hpp" // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES -#include "boost/mpl/aux_/lambda_arity_param.hpp" -#include "boost/mpl/aux_/preprocessor/params.hpp" -#include "boost/mpl/aux_/preprocessor/repeat.hpp" -#include "boost/mpl/int_fwd.hpp" -#include "boost/mpl/limits/arity.hpp" -#include "boost/preprocessor/cat.hpp" -#include "boost/preprocessor/empty.hpp" -#include "boost/preprocessor/arithmetic/inc.hpp" -#include "boost/preprocessor/iterate.hpp" +#include <boost/mpl/aux_/config/ctps.hpp> + +#include <boost/variant/detail/substitute_fwd.hpp> +#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES +#include <boost/mpl/aux_/lambda_arity_param.hpp> +#include <boost/mpl/aux_/preprocessor/params.hpp> +#include <boost/mpl/aux_/preprocessor/repeat.hpp> +#include <boost/mpl/int_fwd.hpp> +#include <boost/mpl/limits/arity.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/empty.hpp> +#include <boost/preprocessor/arithmetic/inc.hpp> +#include <boost/preprocessor/iterate.hpp> namespace boost { namespace detail { namespace variant { @@ -158,7 +158,7 @@ struct substitute< /**/ #define BOOST_PP_ITERATION_LIMITS (0,BOOST_MPL_LIMIT_METAFUNCTION_ARITY) -#define BOOST_PP_FILENAME_1 "boost/variant/detail/substitute.hpp" +#define BOOST_PP_FILENAME_1 <boost/variant/detail/substitute.hpp> #include BOOST_PP_ITERATE() #undef BOOST_VARIANT_AUX_SUBSTITUTE_TYPEDEF_IMPL diff --git a/boost/variant/detail/substitute_fwd.hpp b/boost/variant/detail/substitute_fwd.hpp index 8084cb8845..cc490744e1 100644 --- a/boost/variant/detail/substitute_fwd.hpp +++ b/boost/variant/detail/substitute_fwd.hpp @@ -13,9 +13,9 @@ #ifndef BOOST_VARIANT_DETAIL_SUBSTITUTE_FWD_HPP #define BOOST_VARIANT_DETAIL_SUBSTITUTE_FWD_HPP -#include "boost/mpl/aux_/lambda_arity_param.hpp" -#include "boost/mpl/aux_/template_arity.hpp" -#include "boost/mpl/int_fwd.hpp" +#include <boost/mpl/aux_/lambda_arity_param.hpp> +#include <boost/mpl/aux_/template_arity.hpp> +#include <boost/mpl/int_fwd.hpp> /////////////////////////////////////////////////////////////////////////////// @@ -24,8 +24,8 @@ // Defined if 'substitute' is not implementable on the current compiler. // -#include "boost/mpl/aux_/config/ctps.hpp" -#include "boost/mpl/aux_/config/ttp.hpp" +#include <boost/mpl/aux_/config/ctps.hpp> +#include <boost/mpl/aux_/config/ttp.hpp> #if defined(BOOST_NO_TEMPLATE_TEMPLATE_PARAMETERS) \ && !defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) diff --git a/boost/variant/detail/variant_io.hpp b/boost/variant/detail/variant_io.hpp index 192a3dea4a..63df74f24b 100644 --- a/boost/variant/detail/variant_io.hpp +++ b/boost/variant/detail/variant_io.hpp @@ -15,10 +15,10 @@ #include <iosfwd> // for std::basic_ostream forward declare -#include "boost/variant/variant_fwd.hpp" +#include <boost/variant/variant_fwd.hpp> -#include "boost/detail/templated_streams.hpp" -#include "boost/variant/static_visitor.hpp" +#include <boost/detail/templated_streams.hpp> +#include <boost/variant/static_visitor.hpp> namespace boost { diff --git a/boost/variant/detail/visitation_impl.hpp b/boost/variant/detail/visitation_impl.hpp index a36cae5f2b..d741a4ab29 100644 --- a/boost/variant/detail/visitation_impl.hpp +++ b/boost/variant/detail/visitation_impl.hpp @@ -13,27 +13,27 @@ #ifndef BOOST_VARIANT_DETAIL_VISITATION_IMPL_HPP #define BOOST_VARIANT_DETAIL_VISITATION_IMPL_HPP -#include "boost/config.hpp" - -#include "boost/variant/detail/backup_holder.hpp" -#include "boost/variant/detail/cast_storage.hpp" -#include "boost/variant/detail/forced_return.hpp" -#include "boost/variant/detail/generic_result_type.hpp" -#include "boost/variant/variant_fwd.hpp" // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES - -#include "boost/mpl/eval_if.hpp" -#include "boost/mpl/bool.hpp" -#include "boost/mpl/identity.hpp" -#include "boost/mpl/int.hpp" -#include "boost/mpl/next.hpp" -#include "boost/mpl/deref.hpp" -#include "boost/mpl/or.hpp" -#include "boost/preprocessor/cat.hpp" -#include "boost/preprocessor/inc.hpp" -#include "boost/preprocessor/repeat.hpp" -#include "boost/type_traits/is_same.hpp" -#include "boost/type_traits/has_nothrow_copy.hpp" -#include "boost/type_traits/is_nothrow_move_constructible.hpp" +#include <boost/config.hpp> + +#include <boost/variant/detail/backup_holder.hpp> +#include <boost/variant/detail/cast_storage.hpp> +#include <boost/variant/detail/forced_return.hpp> +#include <boost/variant/detail/generic_result_type.hpp> +#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/int.hpp> +#include <boost/mpl/next.hpp> +#include <boost/mpl/deref.hpp> +#include <boost/mpl/or.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/inc.hpp> +#include <boost/preprocessor/repeat.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/has_nothrow_copy.hpp> +#include <boost/type_traits/is_nothrow_move_constructible.hpp> #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) # pragma warning (push) @@ -49,7 +49,7 @@ #if !defined(BOOST_VARIANT_VISITATION_UNROLLING_LIMIT) #ifndef BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES -# include "boost/mpl/limits/list.hpp" +# include <boost/mpl/limits/list.hpp> # define BOOST_VARIANT_VISITATION_UNROLLING_LIMIT \ BOOST_MPL_LIMIT_LIST_SIZE #else @@ -258,7 +258,7 @@ visitation_impl( typedef typename is_same< next_type,apply_visitor_unrolled >::type is_apply_visitor_unrolled; - return visitation_impl( + return detail::variant::visitation_impl( internal_which, logical_which , visitor, storage , is_apply_visitor_unrolled() diff --git a/boost/variant/get.hpp b/boost/variant/get.hpp index 3188a6547a..f3eb84dc29 100644 --- a/boost/variant/get.hpp +++ b/boost/variant/get.hpp @@ -15,19 +15,23 @@ #include <exception> -#include "boost/config.hpp" -#include "boost/detail/workaround.hpp" -#include "boost/static_assert.hpp" -#include "boost/throw_exception.hpp" -#include "boost/utility/addressof.hpp" -#include "boost/variant/variant_fwd.hpp" -#include "boost/variant/detail/element_index.hpp" +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/static_assert.hpp> +#include <boost/throw_exception.hpp> +#include <boost/utility/addressof.hpp> +#include <boost/variant/variant_fwd.hpp> +#include <boost/variant/detail/element_index.hpp> -#include "boost/type_traits/add_reference.hpp" -#include "boost/type_traits/add_pointer.hpp" +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/add_pointer.hpp> namespace boost { +#if defined(BOOST_CLANG) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wweak-vtables" +#endif ////////////////////////////////////////////////////////////////////////// // class bad_get // @@ -45,6 +49,10 @@ public: // std::exception implementation } }; +#if defined(BOOST_CLANG) +# pragma clang diagnostic pop +#endif + ////////////////////////////////////////////////////////////////////////// // function template get<T> @@ -139,7 +147,7 @@ relaxed_get( ) { typedef typename add_pointer<U>::type U_ptr; - U_ptr result = relaxed_get<U>(&operand); + U_ptr result = relaxed_get<U>(boost::addressof(operand)); if (!result) boost::throw_exception(bad_get()); @@ -155,7 +163,7 @@ relaxed_get( ) { typedef typename add_pointer<const U>::type U_ptr; - U_ptr result = relaxed_get<const U>(&operand); + U_ptr result = relaxed_get<const U>(boost::addressof(operand)); if (!result) boost::throw_exception(bad_get()); diff --git a/boost/variant/multivisitors.hpp b/boost/variant/multivisitors.hpp index 9e24950563..18ae015ee4 100644 --- a/boost/variant/multivisitors.hpp +++ b/boost/variant/multivisitors.hpp @@ -17,7 +17,7 @@ #endif #include <boost/config.hpp> -#include "boost/variant/variant_fwd.hpp" // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES +#include <boost/variant/variant_fwd.hpp> // for BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES #if !defined(BOOST_VARIANT_DO_NOT_USE_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_HDR_TUPLE) # include <boost/variant/detail/multivisitors_cpp11_based.hpp> diff --git a/boost/variant/polymorphic_get.hpp b/boost/variant/polymorphic_get.hpp index 05d9b0dcc8..89fca36de7 100644 --- a/boost/variant/polymorphic_get.hpp +++ b/boost/variant/polymorphic_get.hpp @@ -14,17 +14,17 @@ #include <exception> -#include "boost/config.hpp" -#include "boost/detail/workaround.hpp" -#include "boost/static_assert.hpp" -#include "boost/throw_exception.hpp" -#include "boost/utility/addressof.hpp" -#include "boost/variant/variant_fwd.hpp" -#include "boost/variant/get.hpp" - -#include "boost/type_traits/add_reference.hpp" -#include "boost/type_traits/add_pointer.hpp" -#include "boost/type_traits/is_base_of.hpp" +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/static_assert.hpp> +#include <boost/throw_exception.hpp> +#include <boost/utility/addressof.hpp> +#include <boost/variant/variant_fwd.hpp> +#include <boost/variant/get.hpp> + +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/add_pointer.hpp> +#include <boost/type_traits/is_base_of.hpp> namespace boost { diff --git a/boost/variant/recursive_variant.hpp b/boost/variant/recursive_variant.hpp index cb5eb4ce79..afba0be640 100644 --- a/boost/variant/recursive_variant.hpp +++ b/boost/variant/recursive_variant.hpp @@ -13,27 +13,27 @@ #ifndef BOOST_VARIANT_RECURSIVE_VARIANT_HPP #define BOOST_VARIANT_RECURSIVE_VARIANT_HPP -#include "boost/variant/variant_fwd.hpp" -#include "boost/variant/detail/enable_recursive.hpp" -#include "boost/variant/detail/substitute_fwd.hpp" -#include "boost/variant/detail/make_variant_list.hpp" -#include "boost/variant/detail/over_sequence.hpp" - -#include "boost/mpl/aux_/lambda_arity_param.hpp" - -#include "boost/mpl/equal.hpp" -#include "boost/mpl/eval_if.hpp" -#include "boost/mpl/identity.hpp" -#include "boost/mpl/if.hpp" -#include "boost/mpl/protect.hpp" -#include "boost/mpl/transform.hpp" -#include "boost/type_traits/is_same.hpp" -#include "boost/preprocessor/cat.hpp" -#include "boost/preprocessor/repeat.hpp" - -#include "boost/mpl/bool.hpp" -#include "boost/mpl/is_sequence.hpp" -#include "boost/variant/variant.hpp" +#include <boost/variant/variant_fwd.hpp> +#include <boost/variant/detail/enable_recursive.hpp> +#include <boost/variant/detail/substitute_fwd.hpp> +#include <boost/variant/detail/make_variant_list.hpp> +#include <boost/variant/detail/over_sequence.hpp> + +#include <boost/mpl/aux_/lambda_arity_param.hpp> + +#include <boost/mpl/equal.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/protect.hpp> +#include <boost/mpl/transform.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/repeat.hpp> + +#include <boost/mpl/bool.hpp> +#include <boost/mpl/is_sequence.hpp> +#include <boost/variant/variant.hpp> namespace boost { diff --git a/boost/variant/recursive_wrapper.hpp b/boost/variant/recursive_wrapper.hpp index f3b88d8ff4..ef32eddc0e 100644 --- a/boost/variant/recursive_wrapper.hpp +++ b/boost/variant/recursive_wrapper.hpp @@ -13,9 +13,9 @@ #ifndef BOOST_VARIANT_RECURSIVE_WRAPPER_HPP #define BOOST_VARIANT_RECURSIVE_WRAPPER_HPP -#include "boost/variant/recursive_wrapper_fwd.hpp" -#include "boost/variant/detail/move.hpp" -#include "boost/checked_delete.hpp" +#include <boost/variant/recursive_wrapper_fwd.hpp> +#include <boost/variant/detail/move.hpp> +#include <boost/checked_delete.hpp> namespace boost { diff --git a/boost/variant/recursive_wrapper_fwd.hpp b/boost/variant/recursive_wrapper_fwd.hpp index b42a68ffaf..2fc4341262 100644 --- a/boost/variant/recursive_wrapper_fwd.hpp +++ b/boost/variant/recursive_wrapper_fwd.hpp @@ -3,8 +3,8 @@ // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // -// Copyright (c) 2002 -// Eric Friedman, Itay Maman +// Copyright (c) 2002 Eric Friedman, Itay Maman +// Copyright (c) 2016 Antony Polukhin // // Portions Copyright (C) 2002 David Abrahams // @@ -16,9 +16,10 @@ #define BOOST_VARIANT_RECURSIVE_WRAPPER_FWD_HPP #include <boost/mpl/bool.hpp> -#include "boost/mpl/aux_/config/ctps.hpp" -#include "boost/mpl/aux_/lambda_support.hpp" +#include <boost/mpl/aux_/config/ctps.hpp> +#include <boost/mpl/aux_/lambda_support.hpp> #include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_constructible.hpp> namespace boost { @@ -40,10 +41,35 @@ namespace boost { // template <typename T> class recursive_wrapper; + +/////////////////////////////////////////////////////////////////////////////// +// metafunction is_constructible partial specializations. +// +// recursive_wrapper<T> is constructible only from T and recursive_wrapper<T>. +// +template <class T> struct is_constructible<recursive_wrapper<T>, T> : boost::true_type{}; +template <class T> struct is_constructible<recursive_wrapper<T>, const T> : boost::true_type{}; +template <class T> struct is_constructible<recursive_wrapper<T>, T&> : boost::true_type{}; +template <class T> struct is_constructible<recursive_wrapper<T>, const T&> : boost::true_type{}; +template <class T> struct is_constructible<recursive_wrapper<T>, recursive_wrapper<T> > : boost::true_type{}; +template <class T> struct is_constructible<recursive_wrapper<T>, const recursive_wrapper<T> > : boost::true_type{}; +template <class T> struct is_constructible<recursive_wrapper<T>, recursive_wrapper<T>& > : boost::true_type{}; +template <class T> struct is_constructible<recursive_wrapper<T>, const recursive_wrapper<T>& > : boost::true_type{}; + +template <class T, class U> struct is_constructible<recursive_wrapper<T>, U > : boost::false_type{}; +template <class T, class U> struct is_constructible<recursive_wrapper<T>, const U > : boost::false_type{}; +template <class T, class U> struct is_constructible<recursive_wrapper<T>, U& > : boost::false_type{}; +template <class T, class U> struct is_constructible<recursive_wrapper<T>, const U& > : boost::false_type{}; +template <class T, class U> struct is_constructible<recursive_wrapper<T>, recursive_wrapper<U> > : boost::false_type{}; +template <class T, class U> struct is_constructible<recursive_wrapper<T>, const recursive_wrapper<U> > : boost::false_type{}; +template <class T, class U> struct is_constructible<recursive_wrapper<T>, recursive_wrapper<U>& > : boost::false_type{}; +template <class T, class U> struct is_constructible<recursive_wrapper<T>, const recursive_wrapper<U>& > : boost::false_type{}; + + /////////////////////////////////////////////////////////////////////////////// // metafunction is_recursive_wrapper (modeled on code by David Abrahams) // -// True iff specified type matches recursive_wrapper<T>. +// True if specified type matches recursive_wrapper<T>. // namespace detail { diff --git a/boost/variant/static_visitor.hpp b/boost/variant/static_visitor.hpp index 27f56747ef..d1fc47e272 100644 --- a/boost/variant/static_visitor.hpp +++ b/boost/variant/static_visitor.hpp @@ -13,11 +13,11 @@ #ifndef BOOST_VARIANT_STATIC_VISITOR_HPP #define BOOST_VARIANT_STATIC_VISITOR_HPP -#include "boost/config.hpp" -#include "boost/detail/workaround.hpp" +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> -#include "boost/mpl/if.hpp" -#include "boost/type_traits/is_base_and_derived.hpp" +#include <boost/mpl/if.hpp> +#include <boost/type_traits/is_base_and_derived.hpp> #include <boost/type_traits/integral_constant.hpp> #include <boost/mpl/aux_/lambda_support.hpp> diff --git a/boost/variant/variant.hpp b/boost/variant/variant.hpp index fa09eb5641..6296238507 100644 --- a/boost/variant/variant.hpp +++ b/boost/variant/variant.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2002-2003 Eric Friedman, Itay Maman -// Copyright (c) 2012-2014 Antony Polukhin +// Copyright (c) 2012-2016 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -18,72 +18,74 @@ #include <cstddef> // for std::size_t #include <new> // for placement new -#include "boost/type_index.hpp" - -#include "boost/variant/detail/config.hpp" -#include "boost/mpl/aux_/value_wknd.hpp" - -#include "boost/variant/variant_fwd.hpp" -#include "boost/variant/detail/backup_holder.hpp" -#include "boost/variant/detail/enable_recursive_fwd.hpp" -#include "boost/variant/detail/forced_return.hpp" -#include "boost/variant/detail/initializer.hpp" -#include "boost/variant/detail/make_variant_list.hpp" -#include "boost/variant/detail/over_sequence.hpp" -#include "boost/variant/detail/visitation_impl.hpp" -#include "boost/variant/detail/hash_variant.hpp" - -#include "boost/variant/detail/generic_result_type.hpp" -#include "boost/variant/detail/move.hpp" - -#include "boost/detail/no_exceptions_support.hpp" -#include "boost/detail/reference_content.hpp" -#include "boost/aligned_storage.hpp" -#include "boost/blank.hpp" -#include "boost/math/common_factor_ct.hpp" -#include "boost/static_assert.hpp" -#include "boost/preprocessor/cat.hpp" -#include "boost/preprocessor/repeat.hpp" -#include "boost/type_traits/alignment_of.hpp" -#include "boost/type_traits/add_const.hpp" -#include "boost/type_traits/has_nothrow_constructor.hpp" -#include "boost/type_traits/has_nothrow_copy.hpp" -#include "boost/type_traits/is_nothrow_move_assignable.hpp" -#include "boost/type_traits/is_nothrow_move_constructible.hpp" -#include "boost/type_traits/is_const.hpp" -#include "boost/type_traits/is_same.hpp" -#include "boost/type_traits/is_rvalue_reference.hpp" -#include "boost/utility/enable_if.hpp" -#include "boost/utility/declval.hpp" -#include "boost/variant/recursive_wrapper_fwd.hpp" -#include "boost/variant/static_visitor.hpp" - -#include "boost/mpl/assert.hpp" -#include "boost/mpl/begin_end.hpp" -#include "boost/mpl/bool.hpp" -#include "boost/mpl/deref.hpp" -#include "boost/mpl/empty.hpp" -#include "boost/mpl/eval_if.hpp" -#include "boost/mpl/find_if.hpp" -#include "boost/mpl/fold.hpp" -#include "boost/mpl/front.hpp" -#include "boost/mpl/identity.hpp" -#include "boost/mpl/if.hpp" -#include "boost/mpl/int.hpp" -#include "boost/mpl/is_sequence.hpp" -#include "boost/mpl/iterator_range.hpp" -#include "boost/mpl/iter_fold_if.hpp" -#include "boost/mpl/logical.hpp" -#include "boost/mpl/max_element.hpp" -#include "boost/mpl/next.hpp" -#include "boost/mpl/not.hpp" -#include "boost/mpl/pair.hpp" -#include "boost/mpl/protect.hpp" -#include "boost/mpl/push_front.hpp" -#include "boost/mpl/same_as.hpp" -#include "boost/mpl/size_t.hpp" -#include "boost/mpl/sizeof.hpp" -#include "boost/mpl/transform.hpp" +#include <boost/type_index.hpp> + +#include <boost/variant/detail/config.hpp> +#include <boost/mpl/aux_/value_wknd.hpp> + +#include <boost/variant/variant_fwd.hpp> +#include <boost/variant/detail/backup_holder.hpp> +#include <boost/variant/detail/enable_recursive_fwd.hpp> +#include <boost/variant/detail/forced_return.hpp> +#include <boost/variant/detail/initializer.hpp> +#include <boost/variant/detail/make_variant_list.hpp> +#include <boost/variant/detail/over_sequence.hpp> +#include <boost/variant/detail/visitation_impl.hpp> +#include <boost/variant/detail/hash_variant.hpp> + +#include <boost/variant/detail/generic_result_type.hpp> +#include <boost/variant/detail/move.hpp> + +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/detail/reference_content.hpp> +#include <boost/aligned_storage.hpp> +#include <boost/blank.hpp> +#include <boost/math/common_factor_ct.hpp> +#include <boost/static_assert.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/repeat.hpp> +#include <boost/type_traits/alignment_of.hpp> +#include <boost/type_traits/add_const.hpp> +#include <boost/type_traits/has_nothrow_constructor.hpp> +#include <boost/type_traits/has_nothrow_copy.hpp> +#include <boost/type_traits/is_nothrow_move_assignable.hpp> +#include <boost/type_traits/is_nothrow_move_constructible.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_rvalue_reference.hpp> +#include <boost/type_traits/is_constructible.hpp> +#include <boost/type_traits/add_lvalue_reference.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/utility/declval.hpp> +#include <boost/variant/recursive_wrapper_fwd.hpp> +#include <boost/variant/static_visitor.hpp> + +#include <boost/mpl/assert.hpp> +#include <boost/mpl/begin_end.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/deref.hpp> +#include <boost/mpl/empty.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/find_if.hpp> +#include <boost/mpl/fold.hpp> +#include <boost/mpl/front.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/int.hpp> +#include <boost/mpl/is_sequence.hpp> +#include <boost/mpl/iterator_range.hpp> +#include <boost/mpl/iter_fold_if.hpp> +#include <boost/mpl/logical.hpp> +#include <boost/mpl/max_element.hpp> +#include <boost/mpl/next.hpp> +#include <boost/mpl/not.hpp> +#include <boost/mpl/pair.hpp> +#include <boost/mpl/protect.hpp> +#include <boost/mpl/push_front.hpp> +#include <boost/mpl/same_as.hpp> +#include <boost/mpl/size_t.hpp> +#include <boost/mpl/sizeof.hpp> +#include <boost/mpl/transform.hpp> /////////////////////////////////////////////////////////////////////////////// // Implementation Macros: @@ -99,14 +101,14 @@ #if defined(BOOST_VARIANT_MINIMIZE_SIZE) # include <climits> // for SCHAR_MAX -# include "boost/mpl/eval_if.hpp" -# include "boost/mpl/equal_to.hpp" -# include "boost/mpl/identity.hpp" -# include "boost/mpl/int.hpp" -# include "boost/mpl/if.hpp" -# include "boost/mpl/less.hpp" -# include "boost/mpl/long.hpp" -# include "boost/mpl/O1_size.hpp" +# include <boost/mpl/eval_if.hpp> +# include <boost/mpl/equal_to.hpp> +# include <boost/mpl/identity.hpp> +# include <boost/mpl/int.hpp> +# include <boost/mpl/if.hpp> +# include <boost/mpl/less.hpp> +# include <boost/mpl/long.hpp> +# include <boost/mpl/O1_size.hpp> #endif @@ -254,6 +256,72 @@ struct is_variant_move_noexcept_assignable { #endif // BOOST_NO_CXX11_NOEXCEPT /////////////////////////////////////////////////////////////////////////////// +// (detail) metafunction is_variant_constructible_from +// +// Derives from true_type if at least one variant's type is constructible from T. +// +template <class T1, class T2> +struct is_constructible_ext: + boost::mpl::or_< + boost::is_constructible< + T1, + T2 + >, + boost::is_constructible< + T1, + typename boost::add_lvalue_reference<T2>::type + > + > +{}; + +template <class T, class Types> +struct is_variant_constructible_from: + boost::mpl::not_< boost::is_same< + typename boost::mpl::find_if< + Types, + is_constructible_ext<boost::mpl::_1, T> + >::type, + typename boost::mpl::end<Types>::type + > > +{}; + +template <BOOST_VARIANT_ENUM_PARAMS(typename T), class Types> +struct is_variant_constructible_from< boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Types >: + boost::is_same< + typename boost::mpl::find_if< + typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::recursive_enabled_types, + mpl::not_< is_variant_constructible_from< boost::mpl::_1, Types> > + >::type, + typename boost::mpl::end< typename boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>::recursive_enabled_types >::type + > +{}; + +template <BOOST_VARIANT_ENUM_PARAMS(typename T), class Types> +struct is_variant_constructible_from< const boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>& , Types >: + is_variant_constructible_from<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Types > +{}; + +template <BOOST_VARIANT_ENUM_PARAMS(typename T), class Types> +struct is_variant_constructible_from< boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>& , Types >: + is_variant_constructible_from<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Types > +{}; + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + +template <BOOST_VARIANT_ENUM_PARAMS(typename T), class Types> +struct is_variant_constructible_from< boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>&& , Types >: + is_variant_constructible_from<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Types > +{}; + +template <BOOST_VARIANT_ENUM_PARAMS(typename T), class Types> +struct is_variant_constructible_from< boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)> const && , Types >: + is_variant_constructible_from<boost::variant<BOOST_VARIANT_ENUM_PARAMS(T)>, Types > +{}; + +#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCE + + +/////////////////////////////////////////////////////////////////////////////// // (detail) metafunction make_storage // // Provides an aligned storage type capable of holding any of the types @@ -899,10 +967,10 @@ public: // structors public: // visitor interfaces template <typename T> - bool operator()(const T& rhs_content) const + bool operator()(T& rhs_content) const { // Since the precondition ensures lhs and rhs types are same, get T... - known_get<const T> getter; + known_get<T> getter; const T& lhs_content = lhs_.apply_visitor(getter); // ...and compare lhs and rhs contents: @@ -1120,6 +1188,7 @@ private: // helpers, for typedefs (below) ::boost::mpl::not_< mpl::empty<specified_types> >::value )); +public: // public typedefs typedef typename mpl::eval_if< is_recursive_ , mpl::transform< @@ -1129,9 +1198,7 @@ private: // helpers, for typedefs (below) > > , mpl::identity< specified_types > - >::type recursive_enabled_types; - -public: // public typedefs + >::type recursive_enabled_types; // used by is_variant_constructible_from<> trait typedef typename mpl::transform< recursive_enabled_types @@ -1648,7 +1715,10 @@ private: // helpers, for structors, below #endif template <BOOST_VARIANT_ENUM_PARAMS(typename U)> - void convert_construct( + typename boost::enable_if<mpl::or_< + boost::is_same<boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>, variant>, + boost::detail::variant::is_variant_constructible_from<boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>&, internal_types> + > >::type convert_construct( boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>& operand , long ) @@ -1657,7 +1727,10 @@ private: // helpers, for structors, below } template <BOOST_VARIANT_ENUM_PARAMS(typename U)> - void convert_construct( + typename boost::enable_if<mpl::or_< + boost::is_same<boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>, variant>, + boost::detail::variant::is_variant_constructible_from<const boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>&, internal_types> + > >::type convert_construct( const boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>& operand , long ) @@ -1667,7 +1740,10 @@ private: // helpers, for structors, below #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <BOOST_VARIANT_ENUM_PARAMS(typename U)> - void convert_construct( + typename boost::enable_if<mpl::or_< + boost::is_same<boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>, variant>, + boost::detail::variant::is_variant_constructible_from<boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>&&, internal_types> + > >::type convert_construct( boost::variant<BOOST_VARIANT_ENUM_PARAMS(U)>&& operand , long ) @@ -1678,27 +1754,12 @@ private: // helpers, for structors, below public: // structors, cont. -#if !defined(BOOST_VARIANT_AUX_BROKEN_CONSTRUCTOR_TEMPLATE_ORDERING) - template <typename T> - variant(const T& operand) - { - convert_construct(operand, 1L); - } - - template <typename T> - variant(T& operand) - { - convert_construct(operand, 1L); - } - -#elif defined(BOOST_VARIANT_AUX_HAS_CONSTRUCTOR_TEMPLATE_ORDERING_SFINAE_WKND) - - // For compilers that cannot distinguish between T& and const T& in - // template constructors, but do fully support SFINAE, we can workaround: - - template <typename T> - variant(const T& operand) + variant(const T& operand, + typename boost::enable_if<mpl::and_< + mpl::not_< boost::is_same<T, variant> >, + boost::detail::variant::is_variant_constructible_from<const T&, internal_types> + > >::type* = 0) { convert_construct(operand, 1L); } @@ -1706,31 +1767,25 @@ public: // structors, cont. template <typename T> variant( T& operand - , typename enable_if< - mpl::not_< is_const<T> > - , void - >::type* = 0 + , typename boost::enable_if<mpl::and_< + mpl::not_< is_const<T> >, + mpl::not_< boost::is_same<T, variant> >, + boost::detail::variant::is_variant_constructible_from<T&, internal_types> + > >::type* = 0 ) { convert_construct(operand, 1L); } -#else // !defined(BOOST_VARIANT_AUX_HAS_CONSTRUCTOR_TEMPLATE_ORDERING_SFINAE_WKND) - - // For compilers that cannot distinguish between T& and const T& in - // template constructors, and do NOT support SFINAE, we can't workaround: - - template <typename T> - variant(const T& operand) - { - convert_construct(operand, 1L); - } -#endif // BOOST_VARIANT_AUX_BROKEN_CONSTRUCTOR_TEMPLATE_ORDERING workarounds - #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <class T> - variant(T&& operand, typename boost::enable_if<boost::is_rvalue_reference<T&&> >::type* = 0, - typename boost::disable_if<boost::is_const<T> >::type* = 0) + variant(T&& operand, + typename boost::enable_if<mpl::and_< + boost::is_rvalue_reference<T&&>, + mpl::not_< boost::is_const<T> >, + mpl::not_< boost::is_same<T, variant> >, + boost::detail::variant::is_variant_constructible_from<T&&, internal_types> + > >::type* = 0) { convert_construct( detail::variant::move(operand), 1L); } @@ -1748,7 +1803,7 @@ public: // structors, cont. // ...and activate the *this's primary storage on success: indicate_which(operand.which()); } - + #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES variant(variant&& operand) BOOST_NOEXCEPT_IF(variant_move_noexcept_constructible::type::value) { @@ -2122,8 +2177,14 @@ public: // modifiers #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template <class T> - typename boost::enable_if_c<boost::is_rvalue_reference<T&&>::value && !boost::is_const<T>::value, variant& >::type - operator=(T&& rhs) + typename boost::enable_if< + boost::mpl::and_< + boost::is_rvalue_reference<T&&>, + mpl::not_< boost::is_const<T> >, + boost::detail::variant::is_variant_constructible_from<T&&, internal_types> + >, + variant& + >::type operator=(T&& rhs) { move_assign( detail::variant::move(rhs) ); return *this; @@ -2131,7 +2192,13 @@ public: // modifiers #endif // BOOST_NO_CXX11_RVALUE_REFERENCES template <typename T> - variant& operator=(const T& rhs) + typename boost::enable_if< + mpl::or_< + boost::is_same<T, variant>, + boost::detail::variant::is_variant_constructible_from<const T&, internal_types> + >, + variant& + >::type operator=(const T& rhs) { assign(rhs); return *this; @@ -2146,7 +2213,7 @@ public: // modifiers #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES variant& operator=(variant&& rhs) -#if !defined(__GNUC__) || (__GNUC__ != 4) || (__GNUC_MINOR__ > 6) +#if !defined(__GNUC__) || (__GNUC__ != 4) || (__GNUC_MINOR__ > 6) || defined(__clang__) BOOST_NOEXCEPT_IF(variant_move_noexcept_constructible::type::value && variant_move_noexcept_assignable::type::value) #endif { @@ -2192,10 +2259,6 @@ public: // queries public: // prevent comparison with foreign types -// Obsolete. Remove. -# define BOOST_VARIANT_AUX_FAIL_COMPARISON_RETURN_TYPE \ - void - template <typename U> void operator==(const U&) const { @@ -2412,7 +2475,7 @@ inline void swap( // implementation additions #if !defined(BOOST_NO_IOSTREAM) -#include "boost/variant/detail/variant_io.hpp" +#include <boost/variant/detail/variant_io.hpp> #endif // BOOST_NO_IOSTREAM #endif // BOOST_VARIANT_VARIANT_HPP diff --git a/boost/variant/variant_fwd.hpp b/boost/variant/variant_fwd.hpp index 4bf90aa1e1..769ecc4e54 100644 --- a/boost/variant/variant_fwd.hpp +++ b/boost/variant/variant_fwd.hpp @@ -4,7 +4,7 @@ //----------------------------------------------------------------------------- // // Copyright (c) 2003 Eric Friedman, Itay Maman -// Copyright (c) 2013 Antony Polukhin +// Copyright (c) 2013-2016 Antony Polukhin // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -13,28 +13,17 @@ #ifndef BOOST_VARIANT_VARIANT_FWD_HPP #define BOOST_VARIANT_VARIANT_FWD_HPP -#include "boost/variant/detail/config.hpp" +#include <boost/variant/detail/config.hpp> -#include "boost/blank_fwd.hpp" -#include "boost/mpl/arg.hpp" -#include "boost/mpl/limits/arity.hpp" -#include "boost/mpl/aux_/na.hpp" -#include "boost/preprocessor/cat.hpp" -#include "boost/preprocessor/enum.hpp" -#include "boost/preprocessor/enum_params.hpp" -#include "boost/preprocessor/enum_shifted_params.hpp" -#include "boost/preprocessor/repeat.hpp" - -/////////////////////////////////////////////////////////////////////////////// -// macro BOOST_VARIANT_NO_REFERENCE_SUPPORT -// -// Defined if variant does not support references as bounded types. -// -#if defined(BOOST_VARIANT_AUX_BROKEN_CONSTRUCTOR_TEMPLATE_ORDERING) \ - && !defined(BOOST_VARIANT_AUX_HAS_CONSTRUCTOR_TEMPLATE_ORDERING_SFINAE_WKND) \ - && !defined(BOOST_VARIANT_NO_REFERENCE_SUPPORT) -# define BOOST_VARIANT_NO_REFERENCE_SUPPORT -#endif +#include <boost/blank_fwd.hpp> +#include <boost/mpl/arg.hpp> +#include <boost/mpl/limits/arity.hpp> +#include <boost/mpl/aux_/na.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/enum.hpp> +#include <boost/preprocessor/enum_params.hpp> +#include <boost/preprocessor/enum_shifted_params.hpp> +#include <boost/preprocessor/repeat.hpp> /////////////////////////////////////////////////////////////////////////////// // macro BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT @@ -54,7 +43,7 @@ // so only types declared w/ MPL lambda workarounds will work. // -#include "boost/variant/detail/substitute_fwd.hpp" +#include <boost/variant/detail/substitute_fwd.hpp> #if defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) \ && !defined(BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT) @@ -140,7 +129,7 @@ // Implementation-defined preprocessor symbol describing the actual // length of variant's pseudo-variadic template parameter list. // -#include "boost/mpl/limits/list.hpp" +#include <boost/mpl/limits/list.hpp> #define BOOST_VARIANT_LIMIT_TYPES \ BOOST_MPL_LIMIT_LIST_SIZE @@ -151,7 +140,7 @@ // arguments. That is, // make_recursive_variant< ..., T<[1], recursive_variant_, ... [N]> >. // -#include "boost/mpl/limits/arity.hpp" +#include <boost/mpl/limits/arity.hpp> #define BOOST_VARIANT_RECURSIVE_VARIANT_MAX_ARITY \ BOOST_MPL_LIMIT_METAFUNCTION_ARITY diff --git a/boost/variant/visitor_ptr.hpp b/boost/variant/visitor_ptr.hpp index 4ddb921279..61bc8dfc5f 100644 --- a/boost/variant/visitor_ptr.hpp +++ b/boost/variant/visitor_ptr.hpp @@ -13,15 +13,15 @@ #ifndef BOOST_VARIANT_VISITOR_PTR_HPP #define BOOST_VARIANT_VISITOR_PTR_HPP -#include "boost/variant/bad_visit.hpp" -#include "boost/variant/static_visitor.hpp" - -#include "boost/mpl/eval_if.hpp" -#include "boost/mpl/identity.hpp" -#include "boost/throw_exception.hpp" -#include "boost/type_traits/add_reference.hpp" -#include "boost/type_traits/is_reference.hpp" -#include "boost/type_traits/is_void.hpp" +#include <boost/variant/bad_visit.hpp> +#include <boost/variant/static_visitor.hpp> + +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/throw_exception.hpp> +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/is_reference.hpp> +#include <boost/type_traits/is_void.hpp> namespace boost { |