[C++-sig] injected constructors

Gideon May gideon at computer.org
Sun Sep 21 17:14:09 CEST 2003


--On Saturday, September 20, 2003 9:38 PM -0400 David Abrahams 
<dave at boost-consulting.com> wrote:
> Injected constructors are implemented, but not yet documented.  See
> libs/python/test/injected.[py/cpp] for examples.

Great! Arrived exactly when I had a definite need for them.

>
> There have also been some changes to the concept requirements for
> CallPolicies which have not yet been documented.  If you have
> problems with your custom-made policies with the current CVS state,
> please let me know.

Dave, when using return_internal_reference<>() with MSVC 7.0 I get
the following warning using the most current CVS.

Ciao,

Gideon

Warning dump :

---------------------------------------------------------------------------
----------------------------------------

vc-C++ 
..\..\..\bin\boost\libs\python\osg\osg.pyd\vc7\release\BoundingSphere.obj
BoundingSphere.cpp
C:\cvs_rep\boost\boost\python\detail\caller.hpp(54) : warning C4307: '*' : 
integral constant overflow
        C:\cvs_rep\boost\boost\python\with_custodian_and_ward.hpp(84) : see 
reference to function template instantiation 'PyObje
ct *boost::python::detail::get<-1>(PyObject *const & )' being compiled
        C:\cvs_rep\boost\boost\python\detail\caller.hpp(218) : see 
reference to function template instantiation 'PyObject *boost
::python::with_custodian_and_ward_postcall<custodian,ward,BasePolicy_>::pos
tcall(const ArgumentPackage & ,PyObject *)' being com
piled
        with
        [
            custodian=0,
            ward=1,
            BasePolicy_=boost::python::default_call_policies,
            ArgumentPackage=argument_package
        ]
        C:\cvs_rep\boost\boost\python\detail\caller.hpp(193) : while 
compiling class-template member function 'PyObject *boost::
python::detail::caller_arity<__formal>::impl<F,Policies,Sig>::operator 
()(PyObject *,PyObject *)'
        with
        [
            __formal=1,
            F=osg::Vec3 &(__thiscall osg::BoundingSphere::* )(void),
 
Policies=boost::python::return_internal_reference<1,boost::python::default_
call_policies>,
            Sig=boost::mpl::vector2<osg::Vec3 
&,boost::python::detail::most_derived<osg::BoundingSphere,osg::BoundingSphe
re>::ty
pe &>
        ]
        C:\cvs_rep\boost\boost\python\detail\caller.hpp(162) : see 
reference to class template instantiation 'boost::python::det
ail::caller_arity<__formal>::impl<F,Policies,Sig>' being compiled
        with
        [
            __formal=1,
            F=osg::Vec3 &(__thiscall osg::BoundingSphere::* )(void),
 
Policies=boost::python::return_internal_reference<1,boost::python::default_
call_policies>,
            Sig=boost::mpl::vector2<osg::Vec3 
&,boost::python::detail::most_derived<osg::BoundingSphere,osg::BoundingSphe
re>::ty
pe &>
        ]
        C:\cvs_rep\boost\boost\python\make_function.hpp(62) : see reference 
to class template instantiation 'boost::python::deta
il::caller<F,CallPolicies,Sig>' being compiled
        with
        [
            F=osg::Vec3 &(__thiscall osg::BoundingSphere::* )(void),
 
CallPolicies=boost::python::return_internal_reference<1,boost::python::defa
ult_call_policies>,
            Sig=boost::mpl::vector2<osg::Vec3 
&,boost::python::detail::most_derived<osg::BoundingSphere,osg::BoundingSphe
re>::ty
pe &>
        ]
        C:\cvs_rep\boost\boost\python\make_function.hpp(144) : see 
reference to function template instantiation 'boost::python::
api::object boost::python::detail::make_function_aux(F,const 
boost::python::return_internal_reference<owner_arg,BasePolicy_> &,c
onst boost::mpl::vector2<T0,T1> &,const 
boost::python::detail::keyword_range 
&,boost::mpl::int_<BOOST_PP_ITERATION_0>)' being co
mpiled
        with
        [
            F=osg::Vec3 &(__thiscall osg::BoundingSphere::* )(void),
            owner_arg=1,
            BasePolicy_=boost::python::default_call_policies,
            T0=osg::Vec3 &,
 
T1=boost::python::detail::most_derived<osg::BoundingSphere,osg::BoundingSph
ere>::type &,
            BOOST_PP_ITERATION_0=0
        ]
        C:\cvs_rep\boost\boost\python\class.hpp(506) : see reference to 
function template instantiation 'boost::python::api::obj
ect boost::python::make_function(F,const 
boost::python::return_internal_reference<owner_arg,BasePolicy_> &,const 
boost::python::
detail::tuple_extract_impl<matched>::apply<Tuple,Predicate>::result_type 
&,const boost::mpl::vector2<T0,T1> &)' being compiled
        with
        [
            F=osg::Vec3 &(__thiscall osg::BoundingSphere::* )(void),
            owner_arg=1,
            BasePolicy_=boost::python::default_call_policies,
            matched=false,
 
Tuple=boost::python::detail::def_helper<boost::python::return_internal_refe
rence<1,boost::python::default_call_polic
ies>,boost::python::detail::not_specified,boost::python::detail::not_specif
ied,boost::python::detail::not_specified>::all_t,
 
Predicate=boost::mpl::aux::lambda_impl<1,true>::result_<boost::python::deta
il::is_reference_to_keywords<boost::mpl::
_1>,boost::mpl::void_>::type,
            T0=osg::Vec3 &,
 
T1=boost::python::detail::most_derived<osg::BoundingSphere,osg::BoundingSph
ere>::type &
        ]
        C:\cvs_rep\boost\boost\python\class.hpp(571) : see reference to 
function template instantiation 'void boost::python::cla
ss_<T,X1,X2,X3>::def_impl(const char *,osg::Vec3 &(__thiscall 
osg::BoundingSphere::* )(void),const boost::python::detail::def_he
lper<T1,T2,T3,T4> &,...)' being compiled
        with
        [
            T=osg::BoundingSphere,
            X1=boost::python::detail::not_specified,
            X2=boost::python::detail::not_specified,
            X3=boost::python::detail::not_specified,
 
T1=boost::python::return_internal_reference<1,boost::python::default_call_p
olicies>,
            T2=boost::python::detail::not_specified,
            T3=boost::python::detail::not_specified,
            T4=boost::python::detail::not_specified
        ]
        C:\cvs_rep\boost\boost\python\class.hpp(304) : see reference to 
function template instantiation 'void boost::python::cla
ss_<T,X1,X2,X3>::def_maybe_overloads(const char *,osg::Vec3 &(__thiscall 
osg::BoundingSphere::* )(void),const boost::python::ret
urn_internal_reference<owner_arg,BasePolicy_> &,...)' being compiled
        with
        [
            T=osg::BoundingSphere,
            X1=boost::python::detail::not_specified,
            X2=boost::python::detail::not_specified,
            X3=boost::python::detail::not_specified,
            owner_arg=1,
            BasePolicy_=boost::python::default_call_policies
        ]
        ..\..\..\libs\python\osg\osg\BoundingSphere.cpp(46) : see reference 
to function template instantiation 'boost::python::c
lass_<T,X1,X2,X3>::self &boost::python::class_<T,X1,X2,X3>::def(const char 
*,osg::Vec3 &(__thiscall osg::BoundingSphere::* )(voi
d),const boost::python::return_internal_reference<owner_arg,BasePolicy_> 
&)' being compiled
        with
        [
            T=osg::BoundingSphere,
            X1=boost::python::detail::not_specified,
            X2=boost::python::detail::not_specified,
            X3=boost::python::detail::not_specified,
            owner_arg=1,
            BasePolicy_=boost::python::default_call_policies
        ]

---------------------------------------------------------------------------
-----------------------------------------


The code snippet is here :

    class_<osg::BoundingSphere>("BoundingSphere",
            "General purpose bounding sphere class for enclosing 
nodes/objects/vertices.\n"
            "Used to bound internal osg::Node's in the scene,\n"
            "to assist in view frustum culling etc.  Similar in function to 
BoundingBox\n"
            "but is quicker for evaluating culling, but generally encloses 
a greater volume\n"
            "than a BoundingBox so will not cull so aggressively.\n")
        .def_readwrite("_center", &osg::BoundingSphere::_center)
        .def_readwrite("_radius", &osg::BoundingSphere::_radius)
        .def(init<osg::Vec3, float>())
        .def("init", &osg::BoundingSphere::init,
            "initialize to invalid values to represent an unset bounding 
sphere.")
        .def("valid", &osg::BoundingSphere::valid,
            "return true if the bounding sphere contains valid values,\n"
            "false if the bounding sphere is effectively unset.")
        .def("set",
            &osg::BoundingSphere::set,
            "set bounding sphere.")
        .def("radius",
 
(float(osg::BoundingSphere::*)()const)&osg::BoundingSphere::radius)
        .def("center",
            (osg::Vec3&(osg::BoundingSphere::*)()) 
&osg::BoundingSphere::center,
            return_internal_reference<>())							// <------------- Warning 
occurs here
        .def("contains", &osg::BoundingSphere::contains,
            "return true is vertex v is within the sphere.")
        .def("intersects", &osg::BoundingSphere::intersects,
            "return true if bounding sphere's intersect each other.")
        ;





More information about the Cplusplus-sig mailing list