[C++-sig] Re: Re: Re: long long unsigned issue...

David Abrahams dave at boost-consulting.com
Sun May 4 12:39:13 CEST 2003


"Milind Patil" <milind_patil at hotmail.com> writes:

> However, I could have a Y_Wrapper class that I can add constructors to.
> Is this possible?...

Yes, that's a good approach, and the only one we currently support
well.  Eventually it should be possible to add factory functions as
constructors, but it isn't yet.

> struct Y_Wrapper: Y {
>   public:
>     Y_Wrapper(PyObject* self_) : self(self_) { }
>     /* ... more constructors ... */
>     Y_Wrapper(PyObject* self_, boost::python::long_  y) : self(self_) { /*
> some code to convert long_ to Y */ }
>
>     PyObject* self;
> };
>
> BOOST_PYTHON_MODULE(hello)
> {
>     class_< Y, Y_Wrapper >("Y", init<  >())
>         .def(init< const Y & >())
>         //... more init defs ...
>         .def(init< long_ >())
>        //...
>     ;
> }


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





More information about the Cplusplus-sig mailing list