[C++-sig] export class constant

troy d. straszheim troy at resophonic.com
Thu Dec 10 15:06:40 CET 2009

Gennadiy Rozental wrote:
> Hi,
> Let's say I have string literal as static C++ class member:
> string Foo::abc = "ABC";
> I'm exporting the class Foo. I'd like to export Foo::abc as well and be able to
> access it on Python side using similar interface: Foo.abc.
> Can I do this using Boost.Python?

Sure, you just pass a pointer/ref to the static to def_readonly().  See the data_members test.



More information about the Cplusplus-sig mailing list