forked from boostorg/type_traits
Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
Process #ifndef...#else...#endif blocks. [SVN r86245]
This commit is contained in:
@ -15,7 +15,6 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
namespace detail {
|
||||
|
||||
template<typename Function> struct function_traits_helper;
|
||||
@ -170,67 +169,6 @@ struct function_traits :
|
||||
{
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
namespace detail {
|
||||
|
||||
template<unsigned N>
|
||||
struct type_of_size
|
||||
{
|
||||
char elements[N];
|
||||
};
|
||||
|
||||
template<typename R>
|
||||
type_of_size<1> function_arity_helper(R (*f)());
|
||||
|
||||
template<typename R, typename T1>
|
||||
type_of_size<2> function_arity_helper(R (*f)(T1));
|
||||
|
||||
template<typename R, typename T1, typename T2>
|
||||
type_of_size<3> function_arity_helper(R (*f)(T1, T2));
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3>
|
||||
type_of_size<4> function_arity_helper(R (*f)(T1, T2, T3));
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4>
|
||||
type_of_size<5> function_arity_helper(R (*f)(T1, T2, T3, T4));
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5>
|
||||
type_of_size<6> function_arity_helper(R (*f)(T1, T2, T3, T4, T5));
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6>
|
||||
type_of_size<7> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6));
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7>
|
||||
type_of_size<8> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7));
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7, typename T8>
|
||||
type_of_size<9> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8));
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7, typename T8, typename T9>
|
||||
type_of_size<10> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8,
|
||||
T9));
|
||||
|
||||
template<typename R, typename T1, typename T2, typename T3, typename T4,
|
||||
typename T5, typename T6, typename T7, typename T8, typename T9,
|
||||
typename T10>
|
||||
type_of_size<11> function_arity_helper(R (*f)(T1, T2, T3, T4, T5, T6, T7, T8,
|
||||
T9, T10));
|
||||
} // end namespace detail
|
||||
|
||||
// Won't work with references
|
||||
template<typename Function>
|
||||
struct function_traits
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(unsigned, arity = (sizeof(boost::detail::function_arity_helper((Function*)0))-1));
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
}
|
||||
|
||||
#endif // BOOST_TT_FUNCTION_TRAITS_HPP_INCLUDED
|
||||
|
@ -93,7 +93,6 @@ struct is_class_impl
|
||||
template <typename T>
|
||||
struct is_class_impl
|
||||
{
|
||||
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(::boost::type_traits::ice_and<
|
||||
::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value,
|
||||
@ -103,16 +102,6 @@ struct is_class_impl
|
||||
::boost::type_traits::ice_not< ::boost::is_void<T>::value >::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_function<T>::value >::value
|
||||
>::value));
|
||||
# else
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(::boost::type_traits::ice_and<
|
||||
::boost::type_traits::ice_not< ::boost::is_union<T>::value >::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_scalar<T>::value >::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_void<T>::value >::value
|
||||
>::value));
|
||||
# endif
|
||||
};
|
||||
|
||||
# endif // BOOST_TT_HAS_CONFORMING_IS_CLASS_IMPLEMENTATION
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# include <boost/type_traits/detail/cv_traits_impl.hpp>
|
||||
# ifdef __GNUC__
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
@ -32,12 +31,6 @@
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
|
||||
# include <boost/type_traits/remove_bounds.hpp>
|
||||
# endif
|
||||
#else
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/is_array.hpp>
|
||||
# include <boost/type_traits/detail/yes_no_type.hpp>
|
||||
# include <boost/type_traits/detail/false_result.hpp>
|
||||
#endif
|
||||
|
||||
// should be the last #include
|
||||
#include <boost/type_traits/detail/bool_trait_def.hpp>
|
||||
|
@ -14,19 +14,9 @@
|
||||
#include <boost/type_traits/config.hpp>
|
||||
#include <boost/type_traits/intrinsics.hpp>
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/type_traits/is_class.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
#else
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/is_pointer.hpp>
|
||||
# include <boost/type_traits/is_member_pointer.hpp>
|
||||
# include <boost/type_traits/is_array.hpp>
|
||||
# include <boost/type_traits/is_void.hpp>
|
||||
# include <boost/type_traits/detail/ice_and.hpp>
|
||||
# include <boost/type_traits/detail/ice_not.hpp>
|
||||
#endif
|
||||
|
||||
// should be always the last #include directive
|
||||
#include <boost/type_traits/detail/bool_trait_def.hpp>
|
||||
@ -41,7 +31,6 @@ namespace boost {
|
||||
|
||||
namespace detail {
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
#pragma warning(push)
|
||||
@ -130,82 +119,6 @@ struct is_empty_impl
|
||||
|
||||
#endif // __BORLANDC__
|
||||
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
#ifdef BOOST_MSVC6_MEMBER_TEMPLATES
|
||||
|
||||
template <typename T>
|
||||
struct empty_helper_t1 : public T
|
||||
{
|
||||
empty_helper_t1();
|
||||
int i[256];
|
||||
};
|
||||
|
||||
struct empty_helper_t2 { int i[256]; };
|
||||
|
||||
template <typename T>
|
||||
struct empty_helper_base
|
||||
{
|
||||
enum { value = (sizeof(empty_helper_t1<T>) == sizeof(empty_helper_t2)) };
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct empty_helper_nonbase
|
||||
{
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
template <bool base>
|
||||
struct empty_helper_chooser
|
||||
{
|
||||
template <typename T> struct result_
|
||||
{
|
||||
typedef empty_helper_nonbase<T> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct empty_helper_chooser<true>
|
||||
{
|
||||
template <typename T> struct result_
|
||||
{
|
||||
typedef empty_helper_base<T> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct is_empty_impl
|
||||
{
|
||||
typedef ::boost::detail::empty_helper_chooser<
|
||||
::boost::type_traits::ice_and<
|
||||
::boost::type_traits::ice_not< ::boost::is_reference<T>::value >::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_convertible<T,double>::value >::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_pointer<T>::value >::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_member_pointer<T>::value >::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_array<T>::value >::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_void<T>::value >::value,
|
||||
::boost::type_traits::ice_not<
|
||||
::boost::is_convertible<T,void const volatile*>::value
|
||||
>::value
|
||||
>::value > chooser;
|
||||
|
||||
typedef typename chooser::template result_<T> result;
|
||||
typedef typename result::type eh_type;
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(::boost::type_traits::ice_or<eh_type::value, BOOST_INTERNAL_IS_EMPTY(T)>::value));
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template <typename T> struct is_empty_impl
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool, value = BOOST_INTERNAL_IS_EMPTY(T));
|
||||
};
|
||||
|
||||
#endif // BOOST_MSVC6_MEMBER_TEMPLATES
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
// these help when the compiler has no partial specialization support:
|
||||
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_empty,void,false)
|
||||
|
@ -26,20 +26,12 @@ namespace detail {
|
||||
template <typename T>
|
||||
struct is_object_impl
|
||||
{
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(::boost::type_traits::ice_and<
|
||||
::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_void<T>::value>::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_function<T>::value>::value
|
||||
>::value));
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(::boost::type_traits::ice_and<
|
||||
::boost::type_traits::ice_not< ::boost::is_reference<T>::value>::value,
|
||||
::boost::type_traits::ice_not< ::boost::is_void<T>::value>::value
|
||||
>::value));
|
||||
#endif
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
@ -33,7 +33,6 @@ template< typename T > struct is_POD;
|
||||
|
||||
namespace detail {
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
template <typename T> struct is_pod_impl
|
||||
{
|
||||
@ -54,71 +53,6 @@ struct is_pod_impl<T[sz]>
|
||||
};
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
template <bool is_array = false>
|
||||
struct is_pod_helper
|
||||
{
|
||||
template <typename T> struct result_
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value =
|
||||
(::boost::type_traits::ice_or<
|
||||
::boost::is_scalar<T>::value,
|
||||
::boost::is_void<T>::value,
|
||||
BOOST_INTERNAL_IS_POD(T)
|
||||
>::value));
|
||||
};
|
||||
};
|
||||
|
||||
template <bool b>
|
||||
struct bool_to_yes_no_type
|
||||
{
|
||||
typedef ::boost::type_traits::no_type type;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct bool_to_yes_no_type<true>
|
||||
{
|
||||
typedef ::boost::type_traits::yes_type type;
|
||||
};
|
||||
|
||||
template <typename ArrayType>
|
||||
struct is_pod_array_helper
|
||||
{
|
||||
enum { is_pod = ::boost::is_POD<ArrayType>::value }; // MSVC workaround
|
||||
typedef typename bool_to_yes_no_type<is_pod>::type type;
|
||||
type instance() const;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
is_pod_array_helper<T> is_POD_array(T*);
|
||||
|
||||
template <>
|
||||
struct is_pod_helper<true>
|
||||
{
|
||||
template <typename T> struct result_
|
||||
{
|
||||
static T& help();
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
sizeof(is_POD_array(help()).instance()) == sizeof(::boost::type_traits::yes_type)
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
template <typename T> struct is_pod_impl
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value = (
|
||||
::boost::detail::is_pod_helper<
|
||||
::boost::is_array<T>::value
|
||||
>::template result_<T>::value
|
||||
)
|
||||
);
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
// the following help compilers without partial specialization support:
|
||||
BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,void,true)
|
||||
|
@ -27,7 +27,6 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_same,T,U,false)
|
||||
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename T,is_same,T,T,true)
|
||||
@ -37,58 +36,6 @@ BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename T,is_same,T,T,true)
|
||||
BOOST_TT_AUX_BOOL_TRAIT_PARTIAL_SPEC2_1(typename T,is_same,T&,T&,true)
|
||||
#endif
|
||||
|
||||
#else // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
namespace detail {
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
// the following VC6 specific implementation is *NOT* legal
|
||||
// C++, but has the advantage that it works for incomplete
|
||||
// types.
|
||||
|
||||
template< typename T1 >
|
||||
struct is_same_part_1
|
||||
{
|
||||
template<typename T2> struct part_2 { enum { value = false }; };
|
||||
template<> struct part_2<T1> { enum { value = true }; };
|
||||
};
|
||||
|
||||
template< typename T1, typename T2 >
|
||||
struct is_same_impl
|
||||
{
|
||||
enum { value = boost::detail::is_same_part_1<T1>::template part_2<T2>::value };
|
||||
};
|
||||
|
||||
#else // generic "no-partial-specialization" version
|
||||
|
||||
template <typename T>
|
||||
::boost::type_traits::yes_type
|
||||
BOOST_TT_DECL is_same_tester(T*, T*);
|
||||
|
||||
::boost::type_traits::no_type
|
||||
BOOST_TT_DECL is_same_tester(...);
|
||||
|
||||
template <typename T, typename U>
|
||||
struct is_same_impl
|
||||
{
|
||||
static T t;
|
||||
static U u;
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, value =
|
||||
(::boost::type_traits::ice_and<
|
||||
(sizeof(type_traits::yes_type) == sizeof(boost::detail::is_same_tester(&t,&u))),
|
||||
(::boost::is_reference<T>::value == ::boost::is_reference<U>::value),
|
||||
(sizeof(T) == sizeof(U))
|
||||
>::value));
|
||||
};
|
||||
|
||||
#endif // BOOST_MSVC
|
||||
|
||||
} // namespace detail
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF2(is_same,T,U,(::boost::detail::is_same_impl<T,U>::value))
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
@ -24,17 +24,10 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# include <boost/type_traits/detail/cv_traits_impl.hpp>
|
||||
# if BOOST_WORKAROUND(BOOST_MSVC, < 1400)
|
||||
# include <boost/type_traits/remove_bounds.hpp>
|
||||
# endif
|
||||
#else
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/is_array.hpp>
|
||||
# include <boost/type_traits/detail/yes_no_type.hpp>
|
||||
# include <boost/type_traits/detail/false_result.hpp>
|
||||
#endif
|
||||
|
||||
// should be the last #include
|
||||
#include <boost/type_traits/detail/bool_trait_def.hpp>
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -73,11 +72,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T
|
||||
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_const,T const volatile[N],T volatile type[N])
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_const,T,typename boost::detail::remove_const_impl<T>::type)
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
@ -23,7 +23,6 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
namespace detail{
|
||||
|
||||
@ -57,21 +56,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T vol
|
||||
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_cv,T const volatile[N],T type[N])
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
namespace detail {
|
||||
template <typename T>
|
||||
struct remove_cv_impl
|
||||
{
|
||||
typedef typename remove_volatile_impl<
|
||||
typename remove_const_impl<T>::type
|
||||
>::type type;
|
||||
};
|
||||
}
|
||||
|
||||
BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::remove_cv_impl<T>::type)
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
namespace detail{
|
||||
//
|
||||
@ -53,11 +52,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& volatile,
|
||||
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_reference,T& const volatile,T)
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_reference,T,typename boost::detail::remove_reference_impl<T>::type)
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
@ -24,7 +24,6 @@
|
||||
|
||||
namespace boost {
|
||||
|
||||
#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
namespace detail {
|
||||
|
||||
@ -71,11 +70,6 @@ BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile
|
||||
BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(typename T,std::size_t N,remove_volatile,T const volatile[N],T const type[N])
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
||||
BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_volatile,T,typename boost::detail::remove_volatile_impl<T>::type)
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
} // namespace boost
|
||||
|
||||
|
Reference in New Issue
Block a user