Boost logo

Boost :

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


I was going to use a special template parameter to indicate that rare case.

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

-----------------------------------------------------------
           David Abrahams * Boost Consulting
dave_at_[hidden] * http://www.boost-consulting.com

----- Original Message -----
From: "Brad King" <brad.king_at_[hidden]>
To: "boost" <boost_at_[hidden]>
Sent: Tuesday, August 13, 2002 2:43 PM
Subject: Re: [boost] Error if member function not called?

> Dave,
>
> > What I'd like is to be able to generate a compiler warning or error if
> > the user fails to call the def_init() member function somewhere in the
> > chain. Any ideas?
>
> 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


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