mirror of
https://github.com/boostorg/python.git
synced 2026-01-24 18:12:43 +00:00
removed signature<...> and updated defaults.cpp test
[SVN r15071]
This commit is contained in:
@@ -21,68 +21,27 @@
|
||||
#include <boost/mpl/type_list.hpp>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
namespace boost { namespace python {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// signature
|
||||
//
|
||||
// This template struct acts as a type holder for the signature of a
|
||||
// function or member function. This struct is used to pass in the
|
||||
// return type, class (for member functions) and arguments of a
|
||||
// function or member function. Examples:
|
||||
//
|
||||
// signature<int(*)(int)> int foo(int)
|
||||
// signature<void(*)(int, int)> void foo(int, int)
|
||||
// signature<void(C::*)(int)> void C::foo(int, int)
|
||||
// signature<void(C::*)(int) const> void C::foo(int, int) const
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
template <typename T>
|
||||
struct signature {};
|
||||
|
||||
namespace detail {
|
||||
namespace boost { namespace python { namespace detail {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// The following macros generate expansions for:
|
||||
//
|
||||
// template <typename RT, typename T0... typename TN>
|
||||
// inline boost::mpl::type_list<RT, T0...TN>
|
||||
// get_signature(signature<RT(*)(T0...TN)>)
|
||||
// {
|
||||
// return boost::mpl::type_list<RT, T0...TN>();
|
||||
// }
|
||||
//
|
||||
// template <typename RT, typename T0... typename TN>
|
||||
// template <class RT, class T0... class TN>
|
||||
// inline boost::mpl::type_list<RT, T0...TN>
|
||||
// get_signature(RT(*)(T0...TN))
|
||||
// {
|
||||
// return boost::mpl::type_list<RT, T0...TN>();
|
||||
// }
|
||||
//
|
||||
// template <typename RT, typename ClassT, typename T0... typename TN>
|
||||
// inline boost::mpl::type_list<RT, ClassT, T0...TN>
|
||||
// get_signature(signature<RT(ClassT::*)(T0...TN))>)
|
||||
// {
|
||||
// return boost::mpl::type_list<RT, ClassT, T0...TN>();
|
||||
// }
|
||||
//
|
||||
// template <typename RT, typename ClassT, typename T0... typename TN>
|
||||
// inline boost::mpl::type_list<RT, ClassT, T0...TN>
|
||||
// get_signature(signature<RT(ClassT::*)(T0...TN) const)>)
|
||||
// {
|
||||
// return boost::mpl::type_list<RT, ClassT const, T0...TN>();
|
||||
// }
|
||||
//
|
||||
// template <typename RT, typename ClassT, typename T0... typename TN>
|
||||
// template <class RT, class ClassT, class T0... class TN>
|
||||
// inline boost::mpl::type_list<RT, ClassT, T0...TN>
|
||||
// get_signature(RT(ClassT::*)(T0...TN)))
|
||||
// {
|
||||
// return boost::mpl::type_list<RT, ClassT, T0...TN>();
|
||||
// }
|
||||
//
|
||||
// template <typename RT, typename ClassT, typename T0... typename TN>
|
||||
// template <class RT, class ClassT, class T0... class TN>
|
||||
// inline boost::mpl::type_list<RT, ClassT, T0...TN>
|
||||
// get_signature(RT(ClassT::*)(T0...TN) const))
|
||||
// {
|
||||
@@ -93,14 +52,14 @@ namespace detail {
|
||||
// and arguments of the input signature and stuffs them in an mpl::type_list.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define BPL_IMPL_TEMPLATE_GEN(INDEX, DATA) typename BOOST_PP_CAT(T, INDEX)
|
||||
#define BOOST_PYTHON_TEMPLATE_GEN(INDEX, DATA) class BOOST_PP_CAT(T, INDEX)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, BOOST_PYTHON_MAX_ARITY-1, <boost/python/signature.hpp>))
|
||||
|
||||
#include BOOST_PP_ITERATE()
|
||||
#undef BPL_IMPL_TEMPLATE_GEN
|
||||
#undef BOOST_PYTHON_TEMPLATE_GEN
|
||||
|
||||
}
|
||||
|
||||
@@ -109,218 +68,52 @@ namespace detail {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#endif // SIGNATURE_JDG20020813_HPP
|
||||
|
||||
|
||||
#else // defined(BOOST_PP_IS_ITERATING)
|
||||
// PP vertical iteration code
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1200))
|
||||
|
||||
template
|
||||
<
|
||||
typename RT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM
|
||||
(
|
||||
BOOST_PP_ITERATION(),
|
||||
BPL_IMPL_TEMPLATE_GEN,
|
||||
BOOST_PP_EMPTY
|
||||
)
|
||||
>
|
||||
inline boost::mpl::type_list
|
||||
<
|
||||
template <
|
||||
class RT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM(BOOST_PP_ITERATION(), BOOST_PYTHON_TEMPLATE_GEN, BOOST_PP_EMPTY)>
|
||||
inline boost::mpl::type_list<
|
||||
RT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>
|
||||
get_signature
|
||||
(signature<RT(*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T))>)
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)>
|
||||
get_signature(RT(*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)))
|
||||
{
|
||||
return boost::mpl::type_list
|
||||
<
|
||||
return boost::mpl::type_list<
|
||||
RT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>();
|
||||
}
|
||||
|
||||
#endif // !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1200))
|
||||
|
||||
///////////////////////////////////////
|
||||
#if !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1300))
|
||||
|
||||
# if defined(__MWERKS__) && __MWERKS__ <= 0x3002 && BOOST_PP_ITERATION() == 0
|
||||
template <typename RT>
|
||||
inline boost::mpl::type_list<RT>
|
||||
get_signature(signature<RT(void)>)
|
||||
{
|
||||
return boost::mpl::type_list<RT>();
|
||||
}
|
||||
# else
|
||||
template
|
||||
<
|
||||
typename RT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM
|
||||
(
|
||||
BOOST_PP_ITERATION(),
|
||||
BPL_IMPL_TEMPLATE_GEN,
|
||||
BOOST_PP_EMPTY
|
||||
)
|
||||
>
|
||||
inline boost::mpl::type_list
|
||||
<
|
||||
RT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>
|
||||
get_signature(
|
||||
signature<
|
||||
RT(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T))
|
||||
>)
|
||||
{
|
||||
return boost::mpl::type_list
|
||||
<
|
||||
RT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>();
|
||||
}
|
||||
# endif
|
||||
|
||||
#endif // !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1300))
|
||||
|
||||
///////////////////////////////////////
|
||||
template
|
||||
<
|
||||
typename RT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM
|
||||
(
|
||||
BOOST_PP_ITERATION(),
|
||||
BPL_IMPL_TEMPLATE_GEN,
|
||||
BOOST_PP_EMPTY
|
||||
)
|
||||
>
|
||||
inline boost::mpl::type_list
|
||||
<
|
||||
RT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>
|
||||
get_signature
|
||||
(RT(*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)))
|
||||
{
|
||||
return boost::mpl::type_list
|
||||
<
|
||||
RT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>();
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)>();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_PP_ITERATION() <= (BOOST_PYTHON_MAX_ARITY - 2)
|
||||
|
||||
#if !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1200))
|
||||
|
||||
template
|
||||
<
|
||||
typename RT, typename ClassT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM
|
||||
(
|
||||
BOOST_PP_ITERATION(),
|
||||
BPL_IMPL_TEMPLATE_GEN,
|
||||
BOOST_PP_EMPTY
|
||||
)
|
||||
>
|
||||
inline boost::mpl::type_list
|
||||
<
|
||||
template <
|
||||
class RT, class ClassT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM(BOOST_PP_ITERATION(), BOOST_PYTHON_TEMPLATE_GEN, BOOST_PP_EMPTY)>
|
||||
inline boost::mpl::type_list<
|
||||
RT, ClassT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>
|
||||
get_signature
|
||||
(signature<RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T))>)
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)>
|
||||
get_signature(RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)))
|
||||
{
|
||||
return boost::mpl::type_list
|
||||
<
|
||||
return boost::mpl::type_list<
|
||||
RT, ClassT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)>
|
||||
();
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)>();
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
template
|
||||
<
|
||||
typename RT, typename ClassT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM
|
||||
(
|
||||
BOOST_PP_ITERATION(),
|
||||
BPL_IMPL_TEMPLATE_GEN,
|
||||
BOOST_PP_EMPTY
|
||||
)
|
||||
>
|
||||
inline boost::mpl::type_list
|
||||
<
|
||||
template <
|
||||
class RT, class ClassT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM(BOOST_PP_ITERATION(), BOOST_PYTHON_TEMPLATE_GEN, BOOST_PP_EMPTY)>
|
||||
inline boost::mpl::type_list<
|
||||
RT, ClassT const BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>
|
||||
get_signature
|
||||
(signature<RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)) const>)
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)>
|
||||
get_signature(RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)) const)
|
||||
{
|
||||
return boost::mpl::type_list
|
||||
<
|
||||
RT, ClassT const
|
||||
BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>();
|
||||
}
|
||||
|
||||
#endif // !(defined(BOOST_MSVC) && (BOOST_MSVC <= 1200))
|
||||
|
||||
///////////////////////////////////////
|
||||
template
|
||||
<
|
||||
typename RT, typename ClassT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM
|
||||
(
|
||||
BOOST_PP_ITERATION(),
|
||||
BPL_IMPL_TEMPLATE_GEN,
|
||||
BOOST_PP_EMPTY
|
||||
)
|
||||
>
|
||||
inline boost::mpl::type_list
|
||||
<
|
||||
RT, ClassT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>
|
||||
get_signature
|
||||
(RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)))
|
||||
{
|
||||
return boost::mpl::type_list
|
||||
<
|
||||
RT, ClassT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>();
|
||||
}
|
||||
|
||||
///////////////////////////////////////
|
||||
template
|
||||
<
|
||||
typename RT, typename ClassT BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM
|
||||
(
|
||||
BOOST_PP_ITERATION(),
|
||||
BPL_IMPL_TEMPLATE_GEN,
|
||||
BOOST_PP_EMPTY
|
||||
)
|
||||
>
|
||||
inline boost::mpl::type_list
|
||||
<
|
||||
RT, ClassT const
|
||||
BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>
|
||||
get_signature
|
||||
(RT(ClassT::*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)) const)
|
||||
{
|
||||
return boost::mpl::type_list
|
||||
<
|
||||
RT, ClassT const
|
||||
BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)
|
||||
>();
|
||||
return boost::mpl::type_list<
|
||||
RT, ClassT const
|
||||
BOOST_PP_COMMA_IF(BOOST_PP_ITERATION())
|
||||
BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)>();
|
||||
}
|
||||
|
||||
#endif // BOOST_PP_ITERATION() < (BOOST_PYTHON_MAX_ARITY - 2)
|
||||
|
||||
Reference in New Issue
Block a user