[interprocess][move] enum template argument fails to be a valid base class

I have find a possible bug on the move emulation on " Boost::Container::Vector with Enum Template Argument - Not Legal Base Class" http://stackoverflow.com/questions/2678476/boostcontainervector-with-enum-te... As rv inherits from the movable class template <class T> class rv : public T { rv(); ~rv(); rv(rv const&); void operator=(rv const&); }; it doesn't works for enum types. With gcc 3.4. I get ../../../boost/interprocess/detail/move.hpp:79: error: base type `Test::Types' fails to be a struct or class type. I don't know if this is a know issue with the move emulation. I have tried to add a specialization for is_movable namespace boost { namespace interprocess { // get inside boost template<> class is_movable<Test::Types> // add custom specialization of is_movable : public mpl::bool_<false> {}; }} but this doesn't works neither. I have tried to specialize the rv template with template <> class rv<Test::Types> { Test::Types v; rv(); ~rv(); rv(rv const&); void operator=(rv const&); operator Test::Types() const {return v;} }; and it compiles but the execution fails. Is there any workaround to this issue or better yet a generic solution? Best, _____________________ Vicente Juan Botet Escribá http://viboes.blogspot.com/

----- Original Message ----- From: "vicente.botet" <vicente.botet@wanadoo.fr> To: <boost@lists.boost.org> Sent: Thursday, April 22, 2010 12:30 AM Subject: [boost] [interprocess][move] enum template argument fails to be avalid base class I have find a possible bug on the move emulation on " Boost::Container::Vector with Enum Template Argument - Not Legal Base Class" http://stackoverflow.com/questions/2678476/boostcontainervector-with-enum-te... As rv inherits from the movable class template <class T> class rv : public T { rv(); ~rv(); rv(rv const&); void operator=(rv const&); }; it doesn't works for enum types. With gcc 3.4. I get ../../../boost/interprocess/detail/move.hpp:79: error: base type `Test::Types' fails to be a struct or class type. I don't know if this is a know issue with the move emulation. I have tried to add a specialization for is_movable namespace boost { namespace interprocess { // get inside boost template<> class is_movable<Test::Types> // add custom specialization of is_movable : public mpl::bool_<false> {}; }} but this doesn't works neither. I have tried to specialize the rv template with template <> class rv<Test::Types> { Test::Types v; rv(); ~rv(); rv(rv const&); void operator=(rv const&); operator Test::Types() const {return v;} }; and it compiles but the execution fails. Is there any workaround to this issue or better yet a generic solution? _______________________________________________ Sorry, the execution doesn't fails with cygwin 3.4 or msvc 9 Express. I'm not sure if the rv specialization works on all the cases. Ion could you comment on this issue? Best, _____________________ Vicente Juan Botet Escribá http://viboes.blogspot.com/

It's a bug in vector. Change in file boost/interprocess/containers/container/detail/utilities.hpp This trait is missing enums: template<class T> struct move_const_ref_type : if_c < ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value ,const T & ,BOOST_INTERPROCESS_CATCH_CONST_RLVALUE(T) > {}; So change ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value> So add an include and add also ::boost::is_enum. #include <boost/type_traits/is_enum.hpp> //... ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value> || ::boost::is_enum<T>::value> I can't use is_movable, because that requires the instantiation of the type and forbids recursive containers, an extra feature for future Boost.Container candidate. That's why vector needs this workaround. Best, Ion

On 22/04/2010 8:36, Ion Gaztañaga wrote:
It's a bug in vector. Change in file
boost/interprocess/containers/container/detail/utilities.hpp
This trait is missing enums:
i think I spoke too fast, is_enum needs compiler intrinsics according to boost documentation, so maybe this approach is not very useful... Best, Ion
participants (2)
-
Ion Gaztañaga
-
vicente.botet