Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2002-08-13 14:29:45


From: "David Abrahams" <dave_at_[hidden]>

> I was going to use a special template parameter to indicate that rare
case.
>
> class_<A, not_constructible>("A").def("method", &A::method)

Come to think of it, I'd probably opt for a special no_init parameter to
the constructor:

    class_<A, not_constructible>("A", no_init).def("method", &A::method)

Thoughts?

-Dave

> From: "Brad King" <brad.king_at_[hidden]>
> >
> > What if the class really doesn't have any public constructors?
> >
> > A* get_A();
> >
> > class A
> > {
> > A() {}
> > friend A* get_A();
> > public:
> > void method();
> > };
> >
> > ...
> >
> > module("my_module")
> > .add(class_<A>("A").def("method", &A::method))
> > .def("get_A", get_A, return_value_policy<manage_new_object>());
> >
> > -Brad
> >
> > _______________________________________________
> > Unsubscribe & other changes:
> http://lists.boost.org/mailman/listinfo.cgi/boost
>
> _______________________________________________
> Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk