[C++-sig] Re: def_readonly and const array members
David Abrahams
dave at boost-consulting.com
Wed Aug 6 15:42:17 CEST 2003
"Jeff Brewer" <jeff at brewer.com> writes:
> I am trying to wrap structs that have character arrays and I'm having
> problems since I moved from MSVC 7 to MSVC 7.1 (VS .NET 2003). Here is
> the struct I'm trying to expose the theArray member of using
> class_::def_readonly:
>
> struct testStruct
> {
> unsigned char theArray[16];
> };
>
> I've created a to_python converter for the unsigned char [16] type but
> I'm getting a "TypeError: No to_python (by-value) converter found for
> C++ type: unsigned char const volatile [8]" when I try to access the
> theArray member in Python. I've tried putting volatile in my typedef for
> the array, but that doesn't seem to help (how C++ binds these type
> modifiers always confuses me so maybe I put it in the wrong place).
>
> Thank you for the help,
>
> Jeff Brewer
> jeff at purplemagma.com
Jeff, the problem appears to be a bug in MSVC 7.1, namely that
typeid(unsigned char[16]) != typeid(unsigned char const volatile[16])
As it should be. I'm looking into a workaround now.
--
Dave Abrahams
Boost Consulting
www.boost-consulting.com
More information about the Cplusplus-sig
mailing list