Skip to content

Commit bb536a0

Browse files
committed
One more step towards handling polymorphism: now we can sort out a 4th parameter
[SVN r16287]
1 parent 8b75273 commit bb536a0

2 files changed

Lines changed: 20 additions & 12 deletions

File tree

include/boost/python/detail/def_helper.hpp

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ namespace detail
6565
struct tuple_extract_base_select
6666
{
6767
typedef typename Tuple::head_type head_type;
68-
typedef typename mpl::apply1<Predicate,head_type>::type match_t;
68+
typedef typename mpl::apply1<Predicate, add_reference<head_type>::type>::type match_t;
6969
BOOST_STATIC_CONSTANT(bool, match = match_t::value);
7070
typedef typename tuple_extract_impl<match>::template apply<Tuple,Predicate> type;
7171
};
@@ -85,15 +85,15 @@ namespace detail
8585
Tuple,
8686
mpl::logical_not<
8787
is_reference_to_class<
88-
add_reference<mpl::_1>
88+
mpl::_1
8989
>
9090
> >
9191
{
9292
};
9393

9494
template <class Tuple>
9595
struct keyword_extract
96-
: tuple_extract<Tuple, is_reference_to_keywords<add_reference<mpl::_1> > >
96+
: tuple_extract<Tuple, is_reference_to_keywords<mpl::_1 > >
9797
{
9898
};
9999

@@ -103,8 +103,8 @@ namespace detail
103103
Tuple,
104104
mpl::logical_and<
105105
mpl::logical_not<is_same<not_specified const&,mpl::_1> >
106-
, is_reference_to_class<add_reference<mpl::_> >
107-
, mpl::logical_not<is_reference_to_keywords<add_reference<mpl::_1> > >
106+
, is_reference_to_class<mpl::_1 >
107+
, mpl::logical_not<is_reference_to_keywords<mpl::_1 > >
108108
>
109109
>
110110
{
@@ -115,20 +115,18 @@ namespace detail
115115
: tuple_extract<
116116
Tuple,
117117
mpl::logical_or<
118-
is_reference_to_function_pointer<mpl::_1>
119-
, is_reference_to_function<mpl::_1>
120-
, is_same<mpl::_1,tuples::null_type>
118+
is_reference_to_function_pointer<mpl::_1 >
119+
, is_reference_to_function<mpl::_1 >
121120
>
122121
>
123122
{
124123
};
125124

126-
# define BOOST_PYTHON_DEF_HELPER_TAIL default_call_policies, keywords<0>, char const*
127125
template <class T1, class T2 = not_specified, class T3 = not_specified>
128126
struct def_helper
129127
{
130128
typedef boost::tuples::tuple<
131-
T1 const&, T2 const&, T3 const&, default_call_policies, keywords<0>, char const*
129+
T1 const&, T2 const&, T3 const&, default_call_policies, keywords<0>, char const*, void(*)()
132130
> all_t;
133131

134132
def_helper(T1 const& a1) : m_all(a1,m_nil,m_nil) {}
@@ -150,8 +148,14 @@ namespace detail
150148
return policy_extract<all_t>::extract(m_all);
151149
}
152150

153-
typedef
154-
typename default_implementation_extract<all_t>::result_type default_implementation() const
151+
private:
152+
typedef typename default_implementation_extract<all_t>::result_type default_implementation_t;
153+
public:
154+
BOOST_STATIC_CONSTANT(
155+
bool, has_default_implementation = (
156+
!is_same<default_implementation_t, tuples::null_type>::value));
157+
158+
default_implementation_t default_implementation() const
155159
{
156160
return policy_extract<all_t>::extract(m_all);
157161
}

include/boost/python/detail/indirect_traits.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ struct is_reference_to_function_pointer_aux
101101
typename remove_reference<T>::type
102102
>::type
103103
>::value));
104+
typedef mpl::bool_c<value> type;
104105
};
105106

106107
template <class T>
@@ -274,12 +275,14 @@ struct is_pointer_to_function_aux
274275
BOOST_STATIC_CONSTANT(
275276
bool, value
276277
= sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type));
278+
typedef mpl::bool_c<value> type;
277279
};
278280

279281
template <class T>
280282
struct is_pointer_to_function
281283
: mpl::if_<is_pointer<T>, is_pointer_to_function_aux<T>, mpl::bool_c<false> >::type
282284
{
285+
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_function,(T))
283286
};
284287

285288
struct false_helper1
@@ -399,6 +402,7 @@ struct is_reference_to_function_pointer
399402
: mpl::if_<is_reference<T>
400403
, is_pointer_to_function_aux<T>, mpl::bool_c<false> >::type
401404
{
405+
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T))
402406
};
403407

404408
template <typename V>

0 commit comments

Comments
 (0)