diff --git a/example/config.hpp b/example/config.hpp deleted file mode 100644 index 978fe7a..0000000 --- a/example/config.hpp +++ /dev/null @@ -1,123 +0,0 @@ -// boost/chrono/config.hpp -------------------------------------------------// - -// Copyright Beman Dawes 2003, 2006, 2008 -// Copyright 2009 Vicente J. Botet Escriba - -// Distributed under the Boost Software License, Version 1.0. (See accompanying -// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -// See http://www.boost.org/libs/chrono for documentation. - -#ifndef BOOST_EX_CHRONO_CONFIG_HPP -#define BOOST_EX_CHRONO_CONFIG_HPP - -#include - -// BOOST_EX_CHRONO_POSIX_API, BOOST_EX_CHRONO_MAC_API, or BOOST_EX_CHRONO_WINDOWS_API -// can be defined by the user to specify which API should be used - -#if defined(BOOST_EX_CHRONO_WINDOWS_API) -# warning Boost.Chrono will use the Windows API -#elif defined(BOOST_EX_CHRONO_MAC_API) -# warning Boost.Chrono will use the Mac API -#elif defined(BOOST_EX_CHRONO_POSIX_API) -# warning Boost.Chrono will use the POSIX API -#endif - -# if defined( BOOST_EX_CHRONO_WINDOWS_API ) && defined( BOOST_EX_CHRONO_POSIX_API ) -# error both BOOST_EX_CHRONO_WINDOWS_API and BOOST_EX_CHRONO_POSIX_API are defined -# elif defined( BOOST_EX_CHRONO_WINDOWS_API ) && defined( BOOST_EX_CHRONO_MAC_API ) -# error both BOOST_EX_CHRONO_WINDOWS_API and BOOST_EX_CHRONO_MAC_API are defined -# elif defined( BOOST_EX_CHRONO_MAC_API ) && defined( BOOST_EX_CHRONO_POSIX_API ) -# error both BOOST_EX_CHRONO_MAC_API and BOOST_EX_CHRONO_POSIX_API are defined -# elif !defined( BOOST_EX_CHRONO_WINDOWS_API ) && !defined( BOOST_EX_CHRONO_MAC_API ) && !defined( BOOST_EX_CHRONO_POSIX_API ) -# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) -# define BOOST_EX_CHRONO_WINDOWS_API -# define BOOST_EX_CHRONO_HAS_CLOCK_MONOTONIC -# define BOOST_EX_CHRONO_HAS_THREAD_CLOCK -# define BOOST_EX_CHRONO_THREAD_CLOCK_IS_MONOTONIC true -# elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -# define BOOST_EX_CHRONO_MAC_API -# define BOOST_EX_CHRONO_HAS_CLOCK_MONOTONIC -# define BOOST_EX_CHRONO_THREAD_CLOCK_IS_MONOTONIC true -# else -# define BOOST_EX_CHRONO_POSIX_API -# endif -# endif - -# if defined( BOOST_EX_CHRONO_POSIX_API ) -# include //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME -# if defined(CLOCK_REALTIME) -# if defined(CLOCK_MONOTONIC) -# define BOOST_EX_CHRONO_HAS_CLOCK_MONOTONIC -# endif -# else -# error does not supply CLOCK_REALTIME -# endif -# if defined(_POSIX_THREAD_CPUTIME) -# define BOOST_EX_CHRONO_HAS_THREAD_CLOCK -# define BOOST_EX_CHRONO_THREAD_CLOCK_IS_MONOTONIC true -# endif -# endif - - - -// enable dynamic linking on Windows ---------------------------------------// - -//# if (defined(BOOST_ALL_DYN_LINK) || defined(BOOST_EX_CHRONO_DYN_LINK)) && defined(__BORLANDC__) && defined(__WIN32__) -//# error Dynamic linking Boost.System does not work for Borland; use static linking instead -//# endif - -#ifdef BOOST_HAS_DECLSPEC // defined by boost.config -// we need to import/export our code only if the user has specifically -// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost -// libraries to be dynamically linked, or BOOST_EX_CHRONO_DYN_LINK -// if they want just this one to be dynamically liked: -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_EX_CHRONO_DYN_LINK) -// export if this is our own source, otherwise import: -#ifdef BOOST_EX_CHRONO_SOURCE -# define BOOST_EX_CHRONO_DECL __declspec(dllexport) -#else -# define BOOST_EX_CHRONO_DECL __declspec(dllimport) -#endif // BOOST_EX_CHRONO_SOURCE -#endif // DYN_LINK -#endif // BOOST_HAS_DECLSPEC -// -// if BOOST_EX_CHRONO_DECL isn't defined yet define it now: -#ifndef BOOST_EX_CHRONO_DECL -#define BOOST_EX_CHRONO_DECL -#endif - -// define constexpr related macros ------------------------------// - -//~ #include -#if defined(BOOST_NO_CXX11_CONSTEXPR) -#define BOOST_EX_CHRONO_CONSTEXPR -#define BOOST_EX_CHRONO_CONST_REF const& -#else -#define BOOST_EX_CHRONO_CONSTEXPR constexpr -#define BOOST_EX_CHRONO_CONST_REF -#endif - -// enable automatic library variant selection ------------------------------// - -#if !defined(BOOST_EX_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_EX_CHRONO_NO_LIB) && !defined(BOOST_CHRONO_NO_LIB) -// -// Set the name of our library; this will get undef'ed by auto_link.hpp -// once it's done with it: -// -#define BOOST_LIB_NAME boost_chrono -// -// If we're importing code from a dll, then tell auto_link.hpp about it: -// -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_EX_CHRONO_DYN_LINK) -# define BOOST_DYN_LINK -#endif -// -// And include the header that does the work: -// -#include -#endif // auto-linking disabled - -#endif // BOOST_EX_CHRONO_CONFIG_HPP - diff --git a/example/duration.hpp b/example/duration.hpp index bede808..6e49b06 100644 --- a/example/duration.hpp +++ b/example/duration.hpp @@ -30,8 +30,8 @@ time2_demo contained this comment: #ifndef BOOST_EX_CHRONO_DURATION_HPP #define BOOST_EX_CHRONO_DURATION_HPP -#include "config.hpp" #include "static_assert.hpp" +#include //~ #include diff --git a/example/static_assert.hpp b/example/static_assert.hpp index b2d912e..08d92b2 100644 --- a/example/static_assert.hpp +++ b/example/static_assert.hpp @@ -9,7 +9,7 @@ #ifndef BOOST_EX_CHRONO_DETAIL_STATIC_ASSERT_HPP #define BOOST_EX_CHRONO_DETAIL_STATIC_ASSERT_HPP -#include "config.hpp" +#include #ifndef BOOST_NO_CXX11_STATIC_ASSERT #define BOOST_EX_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG) diff --git a/example/type_traits/add_rvalue_reference.hpp b/example/type_traits/add_rvalue_reference.hpp deleted file mode 100644 index 28258a0..0000000 --- a/example/type_traits/add_rvalue_reference.hpp +++ /dev/null @@ -1,67 +0,0 @@ -// add_rvalue_reference.hpp ---------------------------------------------------------// - -// Copyright 2010 Vicente J. Botet Escriba - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -#ifndef BOOST_EX_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP -#define BOOST_EX_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP - -#include - -//----------------------------------------------------------------------------// - -#include -#include - -// should be the last #include -#include - -//----------------------------------------------------------------------------// -// // -// C++03 implementation of // -// 20.7.6.2 Reference modifications [meta.trans.ref] // -// Written by Vicente J. Botet Escriba // -// // -// If T names an object or function type then the member typedef type -// shall name T&&; otherwise, type shall name T. [ Note: This rule reflects -// the semantics of reference collapsing. For example, when a type T names -// a type T1&, the type add_rvalue_reference::type is not an rvalue -// reference. -end note ] -//----------------------------------------------------------------------------// - -namespace boost_ex { - -namespace type_traits_detail { - - template - struct add_rvalue_reference_helper - { typedef T type; }; - - template - struct add_rvalue_reference_helper - { -#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) - typedef T&& type; -#else - typedef T type; -#endif - }; - - template - struct add_rvalue_reference_imp - { - typedef typename boost_ex::type_traits_detail::add_rvalue_reference_helper - ::value && !boost::is_reference::value) >::type type; - }; - -} - -BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_rvalue_reference,T,typename boost_ex::type_traits_detail::add_rvalue_reference_imp::type) - -} // namespace boost_ex - -#include - -#endif // BOOST_EX_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP diff --git a/example/type_traits/common_type.hpp b/example/type_traits/common_type.hpp deleted file mode 100644 index 0e8cec2..0000000 --- a/example/type_traits/common_type.hpp +++ /dev/null @@ -1,151 +0,0 @@ -// common_type.hpp ---------------------------------------------------------// - -// Copyright 2008 Howard Hinnant -// Copyright 2008 Beman Dawes - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -#ifndef BOOST_EX_TYPE_TRAITS_EXT_COMMON_TYPE_HPP -#define BOOST_EX_TYPE_TRAITS_EXT_COMMON_TYPE_HPP - -#include - -//----------------------------------------------------------------------------// -#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) -#define BOOST_EX_COMMON_TYPE_ARITY 3 -#endif - -//----------------------------------------------------------------------------// -#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_EX_COMMON_TYPE_DONT_USE_TYPEOF) -#define BOOST_TYPEOF_SILENT -#include // boost wonders never cease! -#endif - -//----------------------------------------------------------------------------// -#ifndef BOOST_NO_CXX11_STATIC_ASSERT -#define BOOST_EX_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG) -#elif defined(BOOST_EX_COMMON_TYPE_USES_STATIC_ASSERT) -#include -#define BOOST_EX_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND) -#elif defined(BOOST_EX_COMMON_TYPE_USES_MPL_ASSERT) -#include -#include -#define BOOST_EX_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) \ - BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES) -#else -//~ #elif defined(BOOST_EX_COMMON_TYPE_USES_ARRAY_ASSERT) -#define BOOST_EX_COMMON_TYPE_CONCAT(A,B) A##B -#define BOOST_EX_COMMON_TYPE_NAME(A,B) BOOST_EX_COMMON_TYPE_CONCAT(A,B) -#define BOOST_EX_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_EX_COMMON_TYPE_NAME(__boost_common_type_test_,__LINE__)[(CND)?1:-1] -//~ #define BOOST_EX_COMMON_TYPE_STATIC_ASSERT(CND, MSG, TYPES) -#endif - -#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_EX_COMMON_TYPE_USES_MPL_ASSERT) -#define BOOST_EX_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE "must be complete type" -#endif - -#if defined(BOOST_NO_CXX11_DECLTYPE) && defined(BOOST_EX_COMMON_TYPE_DONT_USE_TYPEOF) -#include "detail/common_type.hpp" -#include -#endif -#include -#include "declval.hpp" - -//----------------------------------------------------------------------------// -// // -// C++03 implementation of // -// 20.6.7 Other transformations [meta.trans.other] // -// Written by Howard Hinnant // -// Adapted for Boost by Beman Dawes, Vicente Botet and Jeffrey Hellrung // -// // -//----------------------------------------------------------------------------// - -namespace boost_ex { - -// prototype -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template - struct common_type; -#else // or no specialization - template - struct common_type - { - public: - typedef typename common_type::type, V>::type type; - }; -#endif - - -// 1 arg - template -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - struct common_type -#else - struct common_type - -#endif - { - BOOST_EX_COMMON_TYPE_STATIC_ASSERT(sizeof(T) > 0, BOOST_EX_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (T)); - public: - typedef T type; - }; - -// 2 args -namespace type_traits_detail { - - template - struct common_type_2 - { - private: - BOOST_EX_COMMON_TYPE_STATIC_ASSERT(sizeof(T) > 0, BOOST_EX_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (T)); - BOOST_EX_COMMON_TYPE_STATIC_ASSERT(sizeof(U) > 0, BOOST_EX_COMMON_TYPE_MUST_BE_A_COMPLE_TYPE, (U)); - static bool declval_bool(); // workaround gcc bug; not required by std - static typename add_rvalue_reference::type declval_T(); // workaround gcc bug; not required by std - static typename add_rvalue_reference::type declval_U(); // workaround gcc bug; not required by std - -#if !defined(BOOST_NO_CXX11_DECLTYPE) - public: - typedef decltype(declval() ? declval() : declval()) type; -#elif defined(BOOST_EX_COMMON_TYPE_DONT_USE_TYPEOF) - public: - typedef typename detail_type_traits_common_type::common_type_impl< - typename remove_cv::type, - typename remove_cv::type - >::type type; -#else - public: - //~ typedef BOOST_TYPEOF_TPL(declval_bool() ? declval_T() : declval_U()) type; - typedef BOOST_TYPEOF_TPL(declval() ? declval() : declval()) type; -#endif - }; - - template - struct common_type_2 - { - typedef T type; - }; - } - -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template - struct common_type -#else - template - struct common_type -#endif - : type_traits_detail::common_type_2 - { }; - - -// 3 or more args -#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) - template - struct common_type { - public: - typedef typename common_type::type, V...>::type type; - }; -#endif -} // namespace boost_ex - -#endif // BOOST_TYPE_TRAITS_EXT_COMMON_TYPE_HPP diff --git a/example/type_traits/declval.hpp b/example/type_traits/declval.hpp deleted file mode 100644 index 437e345..0000000 --- a/example/type_traits/declval.hpp +++ /dev/null @@ -1,44 +0,0 @@ -// common_type.hpp ---------------------------------------------------------// - -// Copyright 2010 Vicente J. Botet Escriba - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -#ifndef BOOST_EX_TYPE_TRAITS_EXT_DECLVAL__HPP -#define BOOST_EX_TYPE_TRAITS_EXT_DECLVAL__HPP - -#include - -//----------------------------------------------------------------------------// - -#include "add_rvalue_reference.hpp" - -//----------------------------------------------------------------------------// -// // -// C++03 implementation of // -// Written by Vicente J. Botet Escriba // -//~ 20.3.4 Function template declval [declval] -//~ 1 The library provides the function template declval to simplify the definition of expressions which occur as -//~ unevaluated operands. -//~ 2 Remarks: If this function is used, the program is ill-formed. -//~ 3 Remarks: The template parameter T of declval may be an incomplete type. -//~ [ Example: - -//~ template -//~ decltype(static_cast(declval())) convert(From&&); - -//~ declares a function template convert which only participats in overloading if the type From can be -//~ explicitly converted to type To. For another example see class template common_type (20.7.6.6). -end -//~ example ] -// // -//----------------------------------------------------------------------------// - -namespace boost_ex { - - template - typename add_rvalue_reference::type declval(); //noexcept; // as unevaluated operand - -} // namespace boost - -#endif // BOOST_EX_TYPE_TRAITS_EXT_DECLVAL__HPP diff --git a/example/type_traits/detail/common_type.hpp b/example/type_traits/detail/common_type.hpp deleted file mode 100644 index ca7555d..0000000 --- a/example/type_traits/detail/common_type.hpp +++ /dev/null @@ -1,316 +0,0 @@ -/******************************************************************************* - * boost/type_traits/detail/common_type.hpp - * - * Copyright 2010, Jeffrey Hellrung. - * Distributed under the Boost Software License, Version 1.0. (See accompanying - * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - * - * struct boost::common_type - * - * common_type::type is the type of the expression - * b() ? x() : y() - * where b() returns a bool, x() has return type T, and y() has return type U. - * See - * http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2661.htm#common_type - * - * Note that this evaluates to void if one or both of T and U is void. - ******************************************************************************/ - -#ifndef BOOST_EX_TYPE_TRAITS_EXT_DETAIL_COMMON_TYPE_HPP -#define BOOST_EX_TYPE_TRAITS_EXT_DETAIL_COMMON_TYPE_HPP - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -namespace boost_ex -{ - -namespace detail_type_traits_common_type -{ - -/******************************************************************************* - * struct propagate_cv< From, To > - * - * This metafunction propagates cv-qualifiers on type From to type To. - ******************************************************************************/ - -template< class From, class To > -struct propagate_cv -{ typedef To type; }; -template< class From, class To > -struct propagate_cv< const From, To > -{ typedef To const type; }; -template< class From, class To > -struct propagate_cv< volatile From, To > -{ typedef To volatile type; }; -template< class From, class To > -struct propagate_cv< const volatile From, To > -{ typedef To const volatile type; }; - -/******************************************************************************* - * struct is_signable_integral - * - * This metafunction determines if T is an integral type which can be made - * signed or unsigned. - ******************************************************************************/ - -template< class T > -struct is_signable_integral - : mpl::or_< is_integral, is_enum > -{ }; -template<> -struct is_signable_integral< bool > - : false_type -{ }; - -/******************************************************************************* - * struct sizeof_t - * typedef ... yes_type - * typedef ... no_type - * - * These types are integral players in the use of the "sizeof trick", i.e., we - * can distinguish overload selection by inspecting the size of the return type - * of the overload. - ******************************************************************************/ - -template< std::size_t N > struct sizeof_t { char _dummy[N]; }; -typedef sizeof_t<1> yes_type; -typedef sizeof_t<2> no_type; -BOOST_MPL_ASSERT_RELATION( sizeof( yes_type ), ==, 1 ); -BOOST_MPL_ASSERT_RELATION( sizeof( no_type ), ==, 2 ); - -/******************************************************************************* - * rvalue_test(T&) -> no_type - * rvalue_test(...) -> yes_type - * - * These overloads are used to determine the rvalue-ness of an expression. - ******************************************************************************/ - -template< class T > no_type rvalue_test(T&); -yes_type rvalue_test(...); - -/******************************************************************************* - * struct conversion_test_overloads< Sequence > - * - * This struct has multiple overloads of the static member function apply, each - * one taking a single parameter of a type within the Boost.MPL sequence - * Sequence. Each such apply overload has a return type with sizeof equal to - * one plus the index of the parameter type within Sequence. Thus, we can - * deduce the type T of an expression as long as we can generate a finite set of - * candidate types containing T via these apply overloads and the "sizeof - * trick". - ******************************************************************************/ - -template< class First, class Last, std::size_t Index > -struct conversion_test_overloads_iterate - : conversion_test_overloads_iterate< - typename mpl::next< First >::type, Last, Index + 1 - > -{ - using conversion_test_overloads_iterate< - typename mpl::next< First >::type, Last, Index + 1 - >::apply; - static sizeof_t< Index + 1 > - apply(typename mpl::deref< First >::type); -}; - -template< class Last, std::size_t Index > -struct conversion_test_overloads_iterate< Last, Last, Index > -{ static sizeof_t< Index + 1 > apply(...); }; - -template< class Sequence > -struct conversion_test_overloads - : conversion_test_overloads_iterate< - typename mpl::begin< Sequence >::type, - typename mpl::end< Sequence >::type, - 0 - > -{ }; - -/******************************************************************************* - * struct select< Sequence, Index > - * - * select is synonymous with mpl::at_c unless Index equals the size of the - * Boost.MPL Sequence, in which case this evaluates to void. - ******************************************************************************/ - -template< - class Sequence, int Index, - int N = mpl::size< Sequence >::value -> -struct select - : mpl::at_c< Sequence, Index > -{ }; -template< class Sequence, int N > -struct select< Sequence, N, N > -{ typedef void type; }; - -/******************************************************************************* - * class deduce_common_type< T, U, NominalCandidates > - * struct nominal_candidates - * struct common_type_dispatch_on_rvalueness - * struct common_type_impl - * - * These classes and structs implement the logic behind common_type, which goes - * roughly as follows. Let C be the type of the conditional expression - * declval< bool >() ? declval() : declval() - * if C is an rvalue, then: - * let T' and U' be T and U stripped of reference- and cv-qualifiers - * if T' and U' are pointer types, say, T' = V* and U' = W*, then: - * define the set of NominalCandidates to be - * { V*, W*, V'*, W'* } - * where V' is V with whatever cv-qualifiers are on W, and W' is W - * with whatever cv-qualifiers are on V - * else T' and U' are both "signable integral types" (integral and enum - * types excepting bool), then: - * define the set of NominalCandidates to be - * { unsigned(T'), unsigned(U'), signed(T'), signed(U') } - * where unsigned(X) is make_unsigned::type and signed(X) is - * make_signed::type - * else - * define the set of NominalCandidates to be - * { T', U' } - * else - * let V and W be T and U stripped of reference-qualifiers - * define the set of NominalCandidates to be - * { V&, W&, V'&, W'& } - * where V' is V with whatever cv-qualifiers are on W, and W' is W with - * whatever cv-qualifiers are on V - * define the set of Candidates to be equal to the set of NominalCandidates with - * duplicates removed, and use this set of Candidates to determine C using the - * conversion_test_overloads struct - ******************************************************************************/ - -template< class T, class U, class NominalCandidates > -class deduce_common_type -{ - typedef typename mpl::copy< - NominalCandidates, - mpl::inserter< - mpl::vector0<>, - mpl::if_< - mpl::contains< mpl::_1, mpl::_2 >, - mpl::_1, - mpl::push_back< mpl::_1, mpl::_2 > - > - > - >::type candidate_types; - static const int best_candidate_index = - sizeof( conversion_test_overloads< candidate_types >::apply( - declval< bool >() ? declval() : declval() - ) ) - 1; -public: - typedef typename select< candidate_types, best_candidate_index >::type type; -}; - -template< - class T, class U, - class V = typename remove_cv< typename remove_reference::type >::type, - class W = typename remove_cv< typename remove_reference::type >::type, - bool = is_signable_integral::value && is_signable_integral::value -> -struct nominal_candidates; - -template< class T, class U, class V, class W > -struct nominal_candidates< T, U, V, W, false > -{ typedef mpl::vector2 type; }; - -template< class T, class U, class V, class W > -struct nominal_candidates< T, U, V, W, true > -{ - typedef mpl::vector4< - typename make_unsigned::type, - typename make_unsigned::type, - typename make_signed::type, - typename make_signed::type - > type; -}; - -template< class T, class U, class V, class W > -struct nominal_candidates< T, U, V*, W*, false > -{ - typedef mpl::vector4< - V*, W*, - typename propagate_cv::type *, - typename propagate_cv::type * - > type; -}; - -template< - class T, class U, - bool = sizeof( ::boost::detail_type_traits_common_type::rvalue_test( - declval< bool >() ? declval() : declval() - ) ) == sizeof( yes_type ) -> -struct common_type_dispatch_on_rvalueness; - -template< class T, class U > -struct common_type_dispatch_on_rvalueness< T, U, true > - : deduce_common_type< T, U, typename nominal_candidates::type > -{ }; - -template< class T, class U > -struct common_type_dispatch_on_rvalueness< T, U, false > -{ -private: - typedef typename remove_reference::type unrefed_T_type; - typedef typename remove_reference::type unrefed_U_type; -public: - typedef typename deduce_common_type< - T, U, - mpl::vector4< - unrefed_T_type &, - unrefed_U_type &, - typename propagate_cv< unrefed_U_type, unrefed_T_type >::type &, - typename propagate_cv< unrefed_T_type, unrefed_U_type >::type & - > - >::type type; -}; - -template< class T, class U > -struct common_type_impl - : common_type_dispatch_on_rvalueness -{ }; - -template< class T > struct common_type_impl< T, void > { typedef void type; }; -template< class T > struct common_type_impl< void, T > { typedef void type; }; -template<> struct common_type_impl< void, void > { typedef void type; }; -template< > struct common_type_impl< char, short> { typedef int type; }; -template< > struct common_type_impl< short, char> { typedef int type; }; -template< > struct common_type_impl< unsigned char, short> { typedef int type; }; -template< > struct common_type_impl< short, unsigned char> { typedef int type; }; -template< > struct common_type_impl< unsigned char, unsigned short> { typedef int type; }; -template< > struct common_type_impl< unsigned short, unsigned char> { typedef int type; }; -template< > struct common_type_impl< char, unsigned short> { typedef int type; }; -template< > struct common_type_impl< unsigned short, char> { typedef int type; }; - -} // namespace detail_type_traits_common_type - - -} // namespace boost_ex - -#endif // BOOST_EX_TYPE_TRAITS_EXT_DETAIL_COMMON_TYPE_HPP