[C++-sig] Re: injected constructors

David Abrahams dave at boost-consulting.com
Sun Sep 21 17:18:06 CEST 2003


Gideon May <gideon at computer.org> writes:

> --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.

The code snippet is missing the definitions of classes, etc.  Can't
you produce a minimal test case?  I don't even see make_constructor
in here.

> 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.")
>         ;

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com





More information about the Cplusplus-sig mailing list