Boost logo

Boost Users :

From: Falco Hirschenberger (falco.hirschenberger_at_[hidden])
Date: 2007-03-23 10:33:56


Hi,

I have defined a recursive variant type like this:

---
typedef boost::make_recursive_variant<bool,
                     int,
                     double,
                     std::string,
                     std::vector< boost::recursive_variant_ >,
                     std::map<std::string, boost::recursive_variant_>,
                     TGrey8Image,
                     TRgbImage,
                     TRgbaImage>::type TVType;
---
and two containers which can store this type:
---
typedef std::vector<TVType> TVector;
typedef std::map<std::string, TVType> TMap;
---
I wrote a set of unit-tests testing all types of plain and recursive
containers and they work as expected.
I also tested (de-)serialization to a binary archive and there's also no
problem.
Then I implemented a Message class which contains such a TVType + some other
stuff. Serializing and deserializing also works in the tests.
Finally I implemented a client and server with ASIO like the
ASIO "serialization" example. First sending the size of the archive and
then the data itself. The sending works but when I want to deserialize my
message I get the following assertion:
---
testSerialization: /usr/include/boost/variant/detail/visitation_impl.hpp:203:
typename Visitor::result_type boost::detail::variant::visitation_impl(int,
int, Visitor&, VPCV, mpl_::true_, NBF, W*, S*) [with W = mpl_::int_<20>, S
=
boost::detail::variant::visitation_impl_step<boost::mpl::l_iter<boost::mpl::l_end>,
boost::mpl::l_iter<boost::mpl::l_end> >, Visitor =
boost::detail::variant::invoke_visitor<boost::detail::variant::direct_assigner<const
int> >, VPCV = void*, NBF =
boost::variant<boost::detail::variant::recursive_flag<bool>, int, double,
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
std::vector<boost::recursive_variant_,
std::allocator<boost::recursive_variant_> >,
std::map<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, boost::recursive_variant_,
std::less<std::basic_string<char, std::char_traits<char>,
std::allocator<char> > >, std::allocator<std::pair<const
std::basic_string<char, std::char_traits<char>, std::allocator<char> >,
boost::recursive_variant_> > >, CIS::Image2d<unsigned char>,
CIS::Image2d<CIS::RGB>, CIS::Image2d<CIS::RGBA>,
boost::detail::variant::void_, boost::detail::variant::void_,
boost::detail::variant::void_, boost::detail::variant::void_,
boost::detail::variant::void_, boost::detail::variant::void_,
boost::detail::variant::void_, boost::detail::variant::void_,
boost::detail::variant::void_, boost::detail::variant::void_,
boost::detail::variant::void_>::has_fallback_type_]: Assertion `false'
failed.
---
I absolutely don't know what't wrong here the backtrace iss huge but the
point in my code where it happens is the line when deserializing the
message. When I comment out the TVType payload of the message, it works.
I would really appreciate any clue.
Greetings,
        Falco

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net