ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> cpp-sig
cpp-sig
[C++-sig] Re: Call policy with constructor
by David Abrahams other posts by this author
Oct 27 2003 11:00AM messages near this date
[C++-sig] Re: fat class decoration | [C++-sig] Re: container suite feedback & ideas
"Mike Rovner" <mike@[...].com>  writes:

>  Pierre Barbier de Reuille wrote:
> > I want to define a constructor that takes a pointer a keep a reference
> > on it. So I need a call policy like 'with_custodian_and_ward<1,2>()'.
> >
> > But it fails at compile time. Here's me Boost.Python code :
> >
> > class_<RCPtr<Class> >(name, doc, init<optional<Class*> >())
> >       .def(init<RCPtr<Class> >())
> >       .def( init<Class*>(), with_custodian_and_ward<1,2>() )
> >       ;
> 
>  You have to use different syntax:
> 
>        .def( init<Class*>()[with_custodian_and_ward<1,2>()] )
> 
>  See reference at www.boost.org/libs/python/doc/v2/init.html#init-spec

...and you probably don't want the optional<Class*>  in the first
init<...> .


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


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

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved