2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-20 16:52:15 +00:00

Remove BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION

Process #ifndef...#else...#endif blocks.

[SVN r86245]
This commit is contained in:
Stephen Kelly
2013-10-11 23:17:48 +00:00
parent 87f776b178
commit 97f9a10b9c
12 changed files with 0 additions and 482 deletions

View File

@@ -102,7 +102,6 @@ namespace detail
return this->operator,(python::arg(name));
}
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<typename T>
struct is_keywords
{
@@ -126,31 +125,6 @@ namespace detail
typedef mpl::bool_<value> type;
BOOST_PYTHON_MPL_LAMBDA_SUPPORT(1,is_reference_to_keywords,(T))
};
# else
typedef char (&yes_keywords_t)[1];
typedef char (&no_keywords_t)[2];
no_keywords_t is_keywords_test(...);
template<std::size_t nkeywords>
yes_keywords_t is_keywords_test(void (*)(keywords<nkeywords>&));
template<std::size_t nkeywords>
yes_keywords_t is_keywords_test(void (*)(keywords<nkeywords> const&));
template<typename T>
class is_reference_to_keywords
{
public:
BOOST_STATIC_CONSTANT(
bool, value = (
sizeof(detail::is_keywords_test( (void (*)(T))0 ))
== sizeof(detail::yes_keywords_t)));
typedef mpl::bool_<value> type;
BOOST_PYTHON_MPL_LAMBDA_SUPPORT(1,is_reference_to_keywords,(T))
};
# endif
}
inline detail::keywords<1> args(char const* name)

View File

@@ -29,7 +29,6 @@ struct back_reference
T m_value;
};
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<typename T>
class is_back_reference
{
@@ -44,36 +43,6 @@ class is_back_reference<back_reference<T> >
BOOST_STATIC_CONSTANT(bool, value = true);
};
# else // no partial specialization
}} // namespace boost::python
#include <boost/type.hpp>
namespace boost { namespace python {
namespace detail
{
typedef char (&yes_back_reference_t)[1];
typedef char (&no_back_reference_t)[2];
no_back_reference_t is_back_reference_test(...);
template<typename T>
yes_back_reference_t is_back_reference_test(boost::type< back_reference<T> >);
}
template<typename T>
class is_back_reference
{
public:
BOOST_STATIC_CONSTANT(
bool, value = (
sizeof(detail::is_back_reference_test(boost::type<T>()))
== sizeof(detail::yes_back_reference_t)));
};
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
//
// implementations

View File

@@ -24,7 +24,6 @@ namespace boost { namespace python {
namespace detail
{
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T> struct specifies_bases
: mpl::false_
{
@@ -35,23 +34,6 @@ namespace boost { namespace python {
: mpl::true_
{
};
# else
template < BOOST_PP_ENUM_PARAMS(BOOST_PYTHON_MAX_BASES, class Base) >
static char is_bases_helper(bases< BOOST_PYTHON_BASE_PARAMS > const&);
static char (& is_bases_helper(...) )[256];
template <class T>
struct specifies_bases
{
private:
static typename add_reference<T>::type make();
BOOST_STATIC_CONSTANT(bool, non_ref = !is_reference<T>::value);
public:
BOOST_STATIC_CONSTANT(bool, value = non_ref & (sizeof(is_bases_helper(make())) == 1));
typedef mpl::bool_<value> type;
};
# endif
template <class T, class Prev = bases<> >
struct select_bases
: mpl::if_<

74
include/boost/python/converter/object_manager.hpp Executable file → Normal file
View File

@@ -121,7 +121,6 @@ struct is_object_manager
{
};
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T>
struct is_reference_to_object_manager
: mpl::false_
@@ -151,79 +150,6 @@ struct is_reference_to_object_manager<T const volatile&>
: is_object_manager<T>
{
};
# else
namespace detail
{
typedef char (&yes_reference_to_object_manager)[1];
typedef char (&no_reference_to_object_manager)[2];
// A number of nastinesses go on here in order to work around MSVC6
// bugs.
template <class T>
struct is_object_manager_help
{
typedef typename mpl::if_<
is_object_manager<T>
, yes_reference_to_object_manager
, no_reference_to_object_manager
>::type type;
// If we just use the type instead of the result of calling this
// function, VC6 will ICE.
static type call();
};
// A set of overloads for each cv-qualification. The same argument
// is passed twice: the first one is used to unwind the cv*, and the
// second one is used to avoid relying on partial ordering for
// overload resolution.
template <class U>
typename is_object_manager_help<U>
is_object_manager_helper(U*, void*);
template <class U>
typename is_object_manager_help<U>
is_object_manager_helper(U const*, void const*);
template <class U>
typename is_object_manager_help<U>
is_object_manager_helper(U volatile*, void volatile*);
template <class U>
typename is_object_manager_help<U>
is_object_manager_helper(U const volatile*, void const volatile*);
template <class T>
struct is_reference_to_object_manager_nonref
: mpl::false_
{
};
template <class T>
struct is_reference_to_object_manager_ref
{
static T sample_object;
BOOST_STATIC_CONSTANT(
bool, value
= (sizeof(is_object_manager_helper(&sample_object, &sample_object).call())
== sizeof(detail::yes_reference_to_object_manager)
)
);
typedef mpl::bool_<value> type;
};
}
template <class T>
struct is_reference_to_object_manager
: mpl::if_<
is_reference<T>
, detail::is_reference_to_object_manager_ref<T>
, detail::is_reference_to_object_manager_nonref<T>
>::type
{
};
# endif
}}} // namespace boost::python::converter

View File

@@ -14,7 +14,6 @@ namespace boost { namespace python { namespace converter {
struct registration;
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T>
struct registered_pointee
: registered<
@@ -26,37 +25,6 @@ struct registered_pointee
>
{
};
# else
namespace detail
{
template <class T>
struct registered_pointee_base
{
static registration const& converters;
};
}
template <class T>
struct registered_pointee
: detail::registered_pointee_base<
typename add_reference<
typename add_cv<T>::type
>::type
>
{
};
//
// implementations
//
namespace detail
{
template <class T>
registration const& registered_pointee_base<T>::converters
= registry::lookup(pointer_type_id<T>());
}
# endif
}}} // namespace boost::python::converter
#endif // REGISTERED_POINTEE_DWA2002710_HPP

30
include/boost/python/detail/borrowed_ptr.hpp Executable file → Normal file
View File

@@ -19,7 +19,6 @@ template<class T> class borrowed
typedef T type;
};
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<typename T>
struct is_borrowed_ptr
{
@@ -68,35 +67,6 @@ struct is_borrowed_ptr<T*>
};
# endif
# else // no partial specialization
typedef char (&yes_borrowed_ptr_t)[1];
typedef char (&no_borrowed_ptr_t)[2];
no_borrowed_ptr_t is_borrowed_ptr_test(...);
template <class T>
typename mpl::if_c<
is_pointer<T>::value
, T
, int
>::type
is_borrowed_ptr_test1(boost::type<T>);
template<typename T>
yes_borrowed_ptr_t is_borrowed_ptr_test(borrowed<T> const volatile*);
template<typename T>
class is_borrowed_ptr
{
public:
BOOST_STATIC_CONSTANT(
bool, value = (
sizeof(detail::is_borrowed_ptr_test(is_borrowed_ptr_test1(boost::type<T>())))
== sizeof(detail::yes_borrowed_ptr_t)));
};
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
}

View File

@@ -42,7 +42,6 @@ union aligned_storage
// but sizeof() is broken in CodeWarriors <= 8.0
template <class T> struct referent_size;
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T>
struct referent_size<T&>
@@ -51,15 +50,6 @@ union aligned_storage
std::size_t, value = sizeof(T));
};
# else
template <class T> struct referent_size
{
static T f();
BOOST_STATIC_CONSTANT(std::size_t, value = sizeof(f()));
};
# endif
// A metafunction returning a POD type which can store U, where T ==
// U&. If T is not a reference type, returns a POD which can store T.

View File

@@ -14,7 +14,6 @@
namespace boost { namespace python { namespace detail {
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T>
struct is_string_literal : mpl::false_
{
@@ -45,43 +44,6 @@ struct is_string_literal<T[n]>
{
};
# endif
# else
template <bool is_array = true>
struct string_literal_helper
{
typedef char (&yes_string_literal)[1];
typedef char (&no_string_literal)[2];
template <class T>
struct apply
{
typedef apply<T> self;
static T x;
static yes_string_literal check(char const*);
static no_string_literal check(char*);
static no_string_literal check(void const volatile*);
BOOST_STATIC_CONSTANT(
bool, value = sizeof(self::check(x)) == sizeof(yes_string_literal));
typedef mpl::bool_<value> type;
};
};
template <>
struct string_literal_helper<false>
{
template <class T>
struct apply : mpl::false_
{
};
};
template <class T>
struct is_string_literal
: string_literal_helper<is_array<T>::value>::apply<T>
{
};
# endif
}}} // namespace boost::python::detail

View File

@@ -155,7 +155,6 @@ typedef handle<PyTypeObject> type_handle;
//
// Compile-time introspection
//
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<typename T>
class is_handle
{
@@ -169,28 +168,6 @@ class is_handle<handle<T> >
public:
BOOST_STATIC_CONSTANT(bool, value = true);
};
# else
namespace detail
{
typedef char (&yes_handle_t)[1];
typedef char (&no_handle_t)[2];
no_handle_t is_handle_test(...);
template<typename T>
yes_handle_t is_handle_test(boost::type< handle<T> >);
}
template<typename T>
class is_handle
{
public:
BOOST_STATIC_CONSTANT(
bool, value = (
sizeof(detail::is_handle_test(boost::type<T>()))
== sizeof(detail::yes_handle_t)));
};
# endif
//
// implementations

View File

@@ -43,7 +43,6 @@ struct forward
{
};
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<typename T>
struct unforward
{
@@ -70,88 +69,6 @@ struct unforward_cref<reference_to_value<T> >
{
};
# else // no partial specialization
namespace detail
{
typedef char (&yes_reference_to_value_t)[1];
typedef char (&no_reference_to_value_t)[2];
no_reference_to_value_t is_reference_to_value_test(...);
template<typename T>
yes_reference_to_value_t is_reference_to_value_test(boost::type< reference_to_value<T> >);
template<bool wrapped>
struct unforwarder
{
template <class T>
struct apply
{
typedef typename unwrap_reference<T>::type& type;
};
};
template<>
struct unforwarder<true>
{
template <class T>
struct apply
{
typedef typename T::reference type;
};
};
template<bool wrapped = false>
struct cref_unforwarder
{
template <class T>
struct apply
: python::detail::value_arg<
typename unwrap_reference<T>::type
>
{
};
};
template<>
struct cref_unforwarder<true>
{
template <class T>
struct apply
: python::detail::value_arg<
typename T::reference
>
{
};
};
template<typename T>
struct is_reference_to_value
{
BOOST_STATIC_CONSTANT(
bool, value = (
sizeof(is_reference_to_value_test(boost::type<T>()))
== sizeof(yes_reference_to_value_t)));
typedef mpl::bool_<value> type;
};
}
template <typename T>
struct unforward
: public detail::unforwarder<
detail::is_reference_to_value<T>::value
>::template apply<T>
{};
template <typename T>
struct unforward_cref
: public detail::cref_unforwarder<
detail::is_reference_to_value<T>::value
>::template apply<T>
{};
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template <class T>
typename reference_to_value<T>::reference

View File

@@ -18,7 +18,6 @@ template<class T> struct other
typedef T type;
};
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
namespace detail
{
template<typename T>
@@ -49,63 +48,6 @@ namespace detail
typedef T type;
};
}
# else // no partial specialization
}} // namespace boost::python
#include <boost/type.hpp>
namespace boost { namespace python {
namespace detail
{
typedef char (&yes_other_t)[1];
typedef char (&no_other_t)[2];
no_other_t is_other_test(...);
template<typename T>
yes_other_t is_other_test(type< other<T> >);
template<bool wrapped>
struct other_unwrapper
{
template <class T>
struct apply
{
typedef T type;
};
};
template<>
struct other_unwrapper<true>
{
template <class T>
struct apply
{
typedef typename T::type type;
};
};
template<typename T>
class is_other
{
public:
BOOST_STATIC_CONSTANT(
bool, value = (
sizeof(detail::is_other_test(type<T>()))
== sizeof(detail::yes_other_t)));
};
template <typename T>
class unwrap_other
: public detail::other_unwrapper<
is_other<T>::value
>::template apply<T>
{};
}
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
}} // namespace boost::python

View File

@@ -36,7 +36,6 @@ inline pointer_wrapper<T> ptr(T t)
return pointer_wrapper<T>(t);
}
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
template<typename T>
class is_pointer_wrapper
: public mpl::false_
@@ -62,64 +61,6 @@ class unwrap_pointer<pointer_wrapper<T> >
public:
typedef T type;
};
# else // no partial specialization
}} // namespace boost::python
#include <boost/type.hpp>
namespace boost { namespace python {
namespace detail
{
typedef char (&yes_pointer_wrapper_t)[1];
typedef char (&no_pointer_wrapper_t)[2];
no_pointer_wrapper_t is_pointer_wrapper_test(...);
template<typename T>
yes_pointer_wrapper_t is_pointer_wrapper_test(boost::type< pointer_wrapper<T> >);
template<bool wrapped>
struct pointer_unwrapper
{
template <class T>
struct apply
{
typedef T type;
};
};
template<>
struct pointer_unwrapper<true>
{
template <class T>
struct apply
{
typedef typename T::type type;
};
};
}
template<typename T>
class is_pointer_wrapper
{
public:
BOOST_STATIC_CONSTANT(
bool, value = (
sizeof(detail::is_pointer_wrapper_test(boost::type<T>()))
== sizeof(detail::yes_pointer_wrapper_t)));
typedef mpl::bool_<value> type;
};
template <typename T>
class unwrap_pointer
: public detail::pointer_unwrapper<
is_pointer_wrapper<T>::value
>::template apply<T>
{};
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
}} // namespace boost::python