statechart events and operator=
As you may know, I'm trying to use boost::statechart::events with boost::variant, but I have the following problem. When I try to assign a statechart::event to a variant<events...> I need to define operator= for my class that is derived from the events.. and then when I call the statechart::event::operator= the compiler throws the following error: /usr/include/boost/statechart/detail/rtti_policy.hpp: In member function 'boost::statechart::detail::rtti_policy::rtti_base_type<boost::statechart::detail::counted_base<true>
& boost::statechart::detail::rtti_policy::rtti_base_type<boost::statechart::detail::counted_base<true> ::operator=(const boost::statechart::detail::rtti_policy::rtti_base_type<boost::statechart::detail::counted_base<true> &)': /usr/include/boost/statechart/detail/rtti_policy.hpp:94: error: non-static reference member 'const boost::statechart::detail::id_provider& boost::statechart::detail::rtti_policy::rtti_base_type<boost::statechart::detail::counted_base<true> ::idProvider_', can't use default assignment operator /usr/include/boost/statechart/event_base.hpp: In member function 'boost::statechart::event_base& boost::statechart::event_base::operator=(const boost::statechart::event_base&)': /usr/include/boost/statechart/event_base.hpp:51: note: synthesized method 'boost::statechart::detail::rtti_policy::rtti_base_type<boost::statechart::detail::counted_base<true> & boost::statechart::detail::rtti_policy::rtti_base_type<boost::statechart::detail::counted_base<true> ::operator=(const boost::statechart::detail::rtti_policy::rtti_base_type<boost::statechart::detail::counted_base<true> &)' first required here /usr/include/boost/statechart/detail/rtti_policy.hpp: In member function 'boost::statechart::detail::rtti_policy::rtti_derived_type<evt_enviar_telegrama, boost::statechart::event_base>& boost::statechart::detail::rtti_policy::rtti_derived_type<evt_enviar_telegrama, boost::statechart::event_base>::operator=(const boost::statechart::detail::rtti_policy::rtti_derived_type<evt_enviar_telegrama, boost::statechart::event_base>&)': /usr/include/boost/statechart/detail/rtti_policy.hpp:149: note: synthesized method 'boost::statechart::event_base& boost::statechart::event_base::operator=(const boost::statechart::event_base&)' first required here /usr/include/boost/statechart/event.hpp: In member function 'boost::statechart::event<evt_enviar_telegrama, std::allocator<void> & boost::statechart::event<evt_enviar_telegrama, std::allocator<void> ::operator=(const boost::statechart::event<evt_enviar_telegrama, std::allocator<void> >&)': /usr/include/boost/statechart/event.hpp:32: note: synthesized method 'boost::statechart::detail::rtti_policy::rtti_derived_type<evt_enviar_telegrama, boost::statechart::event_base>& boost::statechart::detail::rtti_policy::rtti_derived_type<evt_enviar_telegrama, boost::statechart::event_base>::operator=(const boost::statechart::detail::rtti_policy::rtti_derived_type<evt_enviar_telegrama, boost::statechart::event_base>&)' first required here evento.h: In member function 'evt_enviar_telegrama& evt_enviar_telegrama::operator=(const evt_enviar_telegrama&)': evento.h:64: note: synthesized method 'boost::statechart::event<evt_enviar_telegrama, std::allocator<void> & boost::statechart::event<evt_enviar_telegrama, std::allocator<void> ::operator=(const boost::statechart::event<evt_enviar_telegrama, std::allocator<void> >&)' first required here
(evt_enviar_telegrama is one of the types of the variant, and I'm calling sc::event<evt_enviar_telegrama>::operator=(t); line 64) Any clues? Thanks!
Federico J. Fernández wrote:
As you may know, I'm trying to use boost::statechart::events with boost::variant, but I have the following problem. When I try to assign a statechart::event to a variant<events...> I need to define operator= for my class that is derived from the events.. and then when I call the statechart::event::operator= the compiler throws the following error: [snip]
Any clues?
Yes, a statechart::event<> is not currently assignable. This has never cropped up before because statechart::event<> subclass objects are usually passed around wrapped in a boost::intrusive_ptr. The attached patch against the 1.34 branch should correct this problem. HTH, -- Andreas Huber When replying by private email, please remove the words spam and trap from the address shown in the header.
participants (2)
-
Andreas Huber
-
Federico J. Fernández