[C++-sig] enums and structs

Achim Domma achim.domma at syynx.de
Sun May 19 19:34:01 CEST 2002


> -----Original Message-----
> From: c++-sig-admin at python.org [mailto:c++-sig-admin at python.org]On
> Behalf Of David Abrahams
> Sent: Sunday, May 19, 2002 17:39
> To: c++-sig at python.org
> Cc: joel de guzman
> Subject: Re: [C++-sig] enums and structs

> Uhh... well, I guess that's what you'd need to do, until the new interface
> is implemented. However, it's pretty easy to get the from_python
> converters
> (http://www.boost.org/libs/python/doc/v2/implicit.html):
>
>     implicitly_convertible<int, my_enum_type>();

Because I only pass enums to functions, conversion from enum to int should
be enough. It works for me, if I use

	implicitly_convertible<my_enum_type, int>();

which makes sense to me, because I convert enum to int and not the other
way. Am I right? But now I get my next error:

E:\cvsroot\boost\boost/python/detail/arg_tuple_size.hpp(83) : error C2665:
'arg_tuple_size_helper' : none of the 4 overloads can convert parameter 1
from type 'void (__thiscall Magick::Image::*)(const MagickLib::NoiseType)'
        E:\cvsroot\boost\boost/python/make_function.hpp(26) : see reference
to class template instantiation 'boost::python::detail::arg_tuple_size<void
(__thiscall Magick::Image::*)(enum MagickLib::NoiseType)>' being compiled
        E:\cvsroot\boost\boost/python/detail/wrap_function.hpp(30) : see
reference to function template instantiation 'struct
boost::python::objects::function *__cdecl boost::python::make_function(void
(__thiscall Magick::Image::*)(const MagickLib::NoiseType))' being compiled

NoiseType is an enum which I made available via

	implicitly_convertible<MagickLib::NoiseType,int>();

and the function where the problem occures is defined as

	class_<Magick::Image> wrapper_of_Image("Image");
	//...
	wrapper_of_Image
		//some ctors ...
		.def_init(...)
		.def("addNoise",(void (Magick::Image::*)(const
NoiseType))&Magick::Image::addNoise)
		//...

I tried to look to the code, but I failed to understand what the
'sizeof-Magic' in arg_tuple_size.hpp is good for and how it works. Any hint
what's going wrong?

greetings
Achim








More information about the Cplusplus-sig mailing list