[C++-sig] pyste and static const members.

Giulio Eulisse giulio.eulisse at cern.ch
Mon Apr 28 11:42:01 CEST 2003


The following code:

---
#include <string>

class Foo
{
public:
        static const std::string foo;
};
---
Using 

Include("string")
Foo=Class("Foo","foo.h");

as pyste file generates:

[...]
class_< Foo >("Foo", init<  >())
	.def(init< const Foo & >())
	.def_readwrite("foo", &Foo::foo)
	;
[...]

Which, when compiled, gives:
foo.cpp: In function `void init_module_bar()':
foo.cpp:14: no matching function for call to `boost::python::class_<Foo,
boost::python::detail::not_specified,
boost::python::detail::not_specified,
boost::python::detail::not_specified>::def_readwrite(const char[4],
const std::string*)'

Why is that? Do I have to wrap all the static members into getter/setter
methods?

Ciao,
Giulio
PS: Nicodemus: I'm working on the additional qtextedit infos... 






More information about the Cplusplus-sig mailing list