I am decoding bencode and have some code that works well with gcc 4.4. But with the upgrade to gcc 4.6, this code no longer builds:
#ifndef BENCODE_VALUETYPES_H #define BENCODE_VALUETYPES_H #include <boost/variant.hpp> #include <string> #include <vector> #include <map> namespace bencode { typedef boost::make_recursive_variant< int, std::string, std::vector<boost::recursive_variant_>, std::map<std::string, boost::recursive_variant_> >::type Value; typedef std::map<std::string, Value> ValueDictionary; typedef std::vector<Value> ValueVector; }; #endif
g ++ gives the following error message:
/usr/include/c++/4.6/bits/stl_pair.h: In instantiation of 'std::pair<const std::basic_string<char>, boost::recursive_variant_>': Decoder.cpp:97:39: instantiated from here /usr/include/c++/4.6/bits/stl_pair.h:93:11: error: 'std::pair<_T1, _T2>::second' has incomplete type /usr/include/boost/variant/variant_fwd.hpp:232:12: error: forward declaration of 'struct boost::recursive_variant_'
The documentation for the latest version of acceleration (1.48 at the moment) indicates that "due to standard matching issues in several compilers, make_recursive_variant is not universally supported" and you should use recursive_wrapper instead. But I have a change problem: does anyone know how this should look with a wrapper?
source share