[C++-sig] Re: operator ->, cast operator
David Abrahams
dave at boost-consulting.com
Sun Mar 13 01:21:10 CET 2005
"Leonard \"paniq\" Ritter" <paniq at paniq.org> writes:
> followup (heh):
>
> to get the syntax i wished for i wrote a function that went like
>
> template<typename T>
> Ptr<T> New(const String& objectClassName)
> {
> return Ptr<T>(objectClassName);
> }
>
> and exposed it via def("View",New<View>), and that works due to
> boost.pythons magical ptr conversion wizardry ;) the class itself is now
> exposed as "ViewInterface" which is not _perfect_, but its sufficient
> since type names dont play a big role in python anyway.
Okay, but you could use make_constructor; it will get you the
interface you want.
> thank you dave for the help, boost.python rocks again :)
Sure.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list