Boost logo

Boost :

From: thedent_at_[hidden]
Date: 2001-04-10 09:26:36


Hi,
I'am using a 3d-engine, which has some important members declared as
static member variables.
But MSVC6 seems to be not capable to compile the code, if i try
to "def_readonly" them.
I get the error described below:

class foo {
public:
  static float bar;
};

python::class_builder<foo> foo_class(this_module, "foo");

foo_class.def_readonly(&foo::bar, "foobar");
                          ^^^
error C2784: 'void __thiscall boost::python::class_builder<class
foo,class boost::python::detail::held_instance<class foo>
>::def_readonly( foo::*,const char *)'
: could not deduce template argument for ' foo::*' from 'float *'

If I remove the static declaration, everything works fine!

Same, if I try to include a global variable as a member variable:

int g_test = 0;
python::class_builder<foo> foo_class(this_module, "foo");
foo_class.def_readonly(&g_test, "foobar");

Any Idea how to use the static member variable (which is, as i
understand, sort of a global variable with limited scope)

Thanks,
David Strippgen


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk