[C++-sig] Global variables (standard C/C++ types)

Stefan Seefeld seefeld at sympatico.ca
Tue Mar 11 01:41:40 CET 2008


pawell wrote:
> Standard c/c++ types like int, double, bool, etc. When I try something like:
> "scope().attr("a") = object(ptr(&some_bool_var));" I get from gcc:
> "/usr/include/boost/python/object/make_instance.hpp:24: error: invalid
> application of ‘sizeof’ to incomplete type"
> I would like to use "a" variable like a standard Python's boolean type ( "a
> = True" ).

int, float, bool and similar types are immutable in python. You can set

scope().attr("a") = some_bool_var;

(copying the value of some_bool_var into a global python variable 'a'). 
But there is no way to store a reference to a boolean variable living in 
C++.

HTH,
		Stefan

-- 

       ...ich hab' noch einen Koffer in Berlin...



More information about the Cplusplus-sig mailing list