1212# include < boost/python/detail/indirect_traits.hpp>
1313# include < boost/mpl/logical/not.hpp>
1414# include < boost/mpl/logical/and.hpp>
15+ # include < boost/mpl/logical/or.hpp>
1516# include < boost/type_traits/add_reference.hpp>
1617# include < boost/mpl/lambda.hpp>
1718# include < boost/mpl/apply.hpp>
@@ -101,29 +102,37 @@ namespace detail
101102 : tuple_extract<
102103 Tuple,
103104 mpl::logical_and<
104- is_reference_to_class<add_reference<mpl::_> >
105+ mpl::logical_not<is_same<not_specified const &,mpl::_1> >
106+ , is_reference_to_class<add_reference<mpl::_> >
105107 , mpl::logical_not<is_reference_to_keywords<add_reference<mpl::_1> > >
106108 >
107109 >
108110 {
109111 };
110112
113+ template <class Tuple >
114+ struct default_implementation_extract
115+ : tuple_extract<
116+ Tuple,
117+ 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>
121+ >
122+ >
123+ {
124+ };
125+
111126# define BOOST_PYTHON_DEF_HELPER_TAIL default_call_policies, keywords<0 >, char const *
112127 template <class T1 , class T2 = not_specified, class T3 = not_specified>
113128 struct def_helper
114129 {
115- typedef typename mpl::if_<
116- is_same<T2, not_specified>
117- , boost::tuples::tuple<T1 const &, BOOST_PYTHON_DEF_HELPER_TAIL>
118- , typename mpl::if_<
119- is_same<T3, not_specified>
120- , boost::tuples::tuple<T1 const &, T2 const &, BOOST_PYTHON_DEF_HELPER_TAIL>
121- , boost::tuples::tuple<T1 const &, T2 const &, T3 const &>
122- >::type
123- >::type all_t ;
130+ typedef boost::tuples::tuple<
131+ T1 const &, T2 const &, T3 const &, default_call_policies, keywords<0 >, char const *
132+ > all_t ;
124133
125- def_helper (T1 const & a1) : m_all(a1) {}
126- def_helper (T1 const & a1, T2 const & a2) : m_all(a1,a2) {}
134+ def_helper (T1 const & a1) : m_all(a1,m_nil,m_nil ) {}
135+ def_helper (T1 const & a1, T2 const & a2) : m_all(a1,a2,m_nil ) {}
127136 def_helper (T1 const & a1, T2 const & a2, T3 const & a3) : m_all(a1,a2,a3) {}
128137
129138 char const * doc () const
@@ -140,8 +149,15 @@ namespace detail
140149 {
141150 return policy_extract<all_t >::extract (m_all);
142151 }
152+
153+ typedef
154+ typename default_implementation_extract<all_t >::result_type default_implementation () const
155+ {
156+ return policy_extract<all_t >::extract (m_all);
157+ }
143158
144159 all_t m_all;
160+ not_specified m_nil;
145161 };
146162# undef BOOST_PYTHON_DEF_HELPER_TAIL
147163}
0 commit comments