[C++-sig] Multiple Constructors

Bilokon, Paul paul.bilokon at lehman.com
Mon Aug 18 17:43:41 CEST 2008


Hi Troy,

My apologies, thanks a lot for pointing this out.

Kind regards,
Paul 

-----Original Message-----
From: c++-sig-bounces at python.org [mailto:c++-sig-bounces at python.org] On
Behalf Of troy d. straszheim
Sent: Monday, August 18, 2008 4:15 PM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] Multiple Constructors

Bilokon, Paul wrote:
> Hi,
> 
> I'm wondering if there is an example that demonstrates how one should 
> deal with classes with multiple constructors with different 
> signatures, e.g.

There is.  It is right in the docs.

class_<World>("World", init<std::string>())
     .def(init<double, double>())
     .def("greet", &World::greet)
     .def("set", &World::set)
;

>     scope in_Term = class_<Term>("Term", init<>())
>         .def(init<const Term::Foo, Bar>())
>         .def(init<const Term::Foo, Bar, bool>())
>         .def(init<const std::string &>())
> 
> I don't think this approach is valid.

You're going to have to be more specific than that.

-t


_______________________________________________
C++-sig mailing list
C++-sig at python.org
http://mail.python.org/mailman/listinfo/c++-sig
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

This message is intended only for the personal and confidential use of the designated recipient(s) named above.  If you are not the intended recipient of this message you are hereby notified that any review, dissemination, distribution or copying of this message is strictly prohibited.  This communication is for information purposes only and should not be regarded as an offer to sell or as a solicitation of an offer to buy any financial product, an official confirmation of any transaction, or as an official statement of Lehman Brothers.  Email transmission cannot be guaranteed to be secure or error-free.  Therefore, we do not represent that this information is complete or accurate and it should not be relied upon as such.  All information is subject to change without notice.




More information about the Cplusplus-sig mailing list