[python] [concept] CallPolicies implementation

Hello all, Does Boost.Python implement the CallPolicies concept? I couldn't find it... http://www.boost.org/doc/libs/1_48_0/libs/python/doc/v2/CallPolicies.html If not, would something like this be OK?? template<class P> struct CallPolicies { BOOST_CONCEPT_ASSERT((ResultConverterGenerator<P::result_converter>)); BOOST_CONCEPT_ASSERT((Metafunction<P::extract_return_type>)) BOOST_CONCEPT_USAGE(CallPolicies) { bool b = x.precall(a); // convertible to bool PyObject* o = x.postcall(a, r); // convertible to PyObject* } private: P x; PyObject* a; PyObject* r; }; I'd have to implement ResultConverterGenerator and Metafunction as well. Thanks. --Lorenzo

on Sun Dec 04 2011, Lorenzo Caminiti <lorcaminiti-AT-gmail.com> wrote:
Hello all,
Does Boost.Python implement the CallPolicies concept? I couldn't find it... http://www.boost.org/doc/libs/1_48_0/libs/python/doc/v2/CallPolicies.html
AFAIK there are no concept-checking classes for Boost.Python.
If not, would something like this be OK??
template<class P> struct CallPolicies { BOOST_CONCEPT_ASSERT((ResultConverterGenerator<P::result_converter>)); BOOST_CONCEPT_ASSERT((Metafunction<P::extract_return_type>))
BOOST_CONCEPT_USAGE(CallPolicies) { bool b = x.precall(a); // convertible to bool PyObject* o = x.postcall(a, r); // convertible to PyObject* }
private: P x; PyObject* a; PyObject* r; };
I suppose so. -- Dave Abrahams BoostPro Computing http://www.boostpro.com
participants (2)
-
Dave Abrahams
-
Lorenzo Caminiti