summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/type_traits/detail/common_type_imp.hpp')
-rw-r--r--3rdParty/Boost/src/boost/type_traits/detail/common_type_imp.hpp81
1 files changed, 56 insertions, 25 deletions
diff --git a/3rdParty/Boost/src/boost/type_traits/detail/common_type_imp.hpp b/3rdParty/Boost/src/boost/type_traits/detail/common_type_imp.hpp
index 9e06282..dd530ca 100644
--- a/3rdParty/Boost/src/boost/type_traits/detail/common_type_imp.hpp
+++ b/3rdParty/Boost/src/boost/type_traits/detail/common_type_imp.hpp
@@ -72,22 +72,46 @@ struct propagate_cv< const volatile From, To >
{ typedef To const volatile type; };
/*******************************************************************************
- * struct is_signable_integral<T>
+ * struct is_integral_or_enum<T>
*
* 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<T>, is_enum<T> >
+struct is_integral_or_enum
+ : public mpl::or_< is_integral<T>, is_enum<T> >
{ };
template<>
-struct is_signable_integral< bool >
- : false_type
+struct is_integral_or_enum< bool >
+ : public false_type
{ };
/*******************************************************************************
+ * struct make_unsigned_soft<T>
+ * struct make_signed_soft<T>
+ *
+ * These metafunction are identical to make_unsigned and make_signed,
+ * respetively, except for special-casing bool.
+ ******************************************************************************/
+
+template< class T >
+struct make_unsigned_soft
+ : public make_unsigned<T>
+{ };
+template<>
+struct make_unsigned_soft< bool >
+{ typedef bool type; };
+
+template< class T >
+struct make_signed_soft
+ : public make_signed<T>
+{ };
+template<>
+struct make_signed_soft< bool >
+{ typedef bool type; };
+
+/*******************************************************************************
* struct sizeof_t<N>
* typedef ... yes_type
* typedef ... no_type
@@ -127,7 +151,7 @@ yes_type rvalue_test(...);
template< class First, class Last, std::size_t Index >
struct conversion_test_overloads_iterate
- : conversion_test_overloads_iterate<
+ : public conversion_test_overloads_iterate<
typename mpl::next< First >::type, Last, Index + 1
>
{
@@ -144,7 +168,7 @@ struct conversion_test_overloads_iterate< Last, Last, Index >
template< class Sequence >
struct conversion_test_overloads
- : conversion_test_overloads_iterate<
+ : public conversion_test_overloads_iterate<
typename mpl::begin< Sequence >::type,
typename mpl::end< Sequence >::type,
0
@@ -163,7 +187,7 @@ template<
int N = mpl::size< Sequence >::value
>
struct select
- : mpl::at_c< Sequence, Index >
+ : public mpl::at_c< Sequence, Index >
{ };
template< class Sequence, int N >
struct select< Sequence, N, N >
@@ -185,12 +209,21 @@ struct select< Sequence, N, N >
* { 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:
+ * else if T' and U' are both integral or enum types, then:
* define the set of NominalCandidates to be
- * { unsigned(T'), unsigned(U'), signed(T'), signed(U') }
- * where unsigned(X) is make_unsigned<X>::type and signed(X) is
- * make_signed<X>::type
+ * {
+ * unsigned_soft(T'),
+ * unsigned_soft(U'),
+ * signed_soft(T'),
+ * signed_soft(U'),
+ * T',
+ * U',
+ * unsigned int,
+ * int
+ * }
+ * where unsigned_soft(X) is make_unsigned_soft<X>::type and
+ * signed_soft(X) is make_signed_soft<X>::type (these are all
+ * generally necessary to cover the various integral promotion cases)
* else
* define the set of NominalCandidates to be
* { T', U' }
@@ -231,22 +264,20 @@ template<
class T, class U,
class V = typename remove_cv< typename remove_reference<T>::type >::type,
class W = typename remove_cv< typename remove_reference<U>::type >::type,
- bool = is_signable_integral<V>::value && is_signable_integral<W>::value
+ bool = is_integral_or_enum<V>::value && is_integral_or_enum<W>::value
>
-struct nominal_candidates;
-
-template< class T, class U, class V, class W >
-struct nominal_candidates< T, U, V, W, false >
+struct nominal_candidates
{ typedef mpl::vector2<V,W> type; };
template< class T, class U, class V, class W >
struct nominal_candidates< T, U, V, W, true >
{
- typedef mpl::vector4<
- typename make_unsigned<V>::type,
- typename make_unsigned<W>::type,
- typename make_signed<V>::type,
- typename make_signed<W>::type
+ typedef boost::mpl::vector8<
+ typename make_unsigned_soft<V>::type,
+ typename make_unsigned_soft<W>::type,
+ typename make_signed_soft<V>::type,
+ typename make_signed_soft<W>::type,
+ V, W, unsigned int, int
> type;
};
@@ -262,7 +293,7 @@ struct nominal_candidates< T, U, V*, W*, false >
template<class T, class U, bool b>
struct common_type_dispatch_on_rvalueness
- : deduce_common_type< T, U, typename nominal_candidates<T,U>::type >
+ : public deduce_common_type< T, U, typename nominal_candidates<T,U>::type >
{ };
template< class T, class U >
@@ -285,7 +316,7 @@ public:
template< class T, class U >
struct common_type_impl
- : common_type_dispatch_on_rvalueness<T,U, sizeof( ::boost::detail_type_traits_common_type::rvalue_test(
+ : public common_type_dispatch_on_rvalueness<T,U, sizeof( ::boost::detail_type_traits_common_type::rvalue_test(
declval< bool >() ? declval<T>() : declval<U>() ) ) == sizeof( yes_type ) >
{ };