
June 26, 2013
1:03 p.m.
26.06.2013 19:34, Nathaniel Smith kirjoitti: [clip]
In c++, user classes can't inherit from primitive types. Thus spake Bjarne.
Make a memory-layout compatible class (i.e., one with a single npy_bool member), and then cast back and forth as needed?
This may also needs appropriate constructors and operator=() npy_bool_wrapper() { value = 0; } npy_bool_wrapper(int x) { value = x ? 1 : 0; } npy_bool_wrapper& operator=(npy_bool_wrapper& x) { value = x; } and ditto possibly for += and other operators. -- Pauli Virtanen