
Check out the Rationale section in the manual for an explanation of this new behavior Robert Ramey Stefan Arentz wrote:
Hello fellow Boost users,
Consider the following program:
#include <sstream> #include <string> #include <vector>
#include <boost/archive/text_oarchive.hpp> #include <boost/serialization/base_object.hpp> #include <boost/serialization/string.hpp> #include <boost/serialization/vector.hpp>
template <typename T> std::string archive(T thing)
change the above to std::string archive(const T & thing) // you don't want to copy or change "thing" do you?
{ std::ostringstream oss; boost::archive::text_oarchive oa(oss); oa << thing; return oss.str(); }
typedef std::vector< std::string > parameters_t;
int main() { parameters_t parameters; parameters.push_back("a"); parameters.push_back("b");
std::string s = archive<parameters_t>(parameters);
return 0; }
When I compile this with Boost 1.32 it compiles and works fine.
However, with Boost.1.33 it fails with:
/usr/local/include/boost/archive/detail/oserializer.hpp: In function `void boost::archive::save(Archive&, T&) [with Archive = boost::archive::text_oarchive, T = std::vector<std::string, std::allocator<std::string> >]': /usr/local/include/boost/archive/basic_text_oarchive.hpp:78: instantiated from `void boost::archive::basic_text_oarchive<Archive>::save_override(T&, int) [with T = std::vector<std::string, std::allocator<std::string> >, Archive = boost::archive::text_oarchive]' /usr/local/include/boost/archive/detail/interface_oarchive.hpp:85: instantiated from `Archive& boost::archive::detail::interface_oarchive<Archive>::operator<<(T&) [with T = parameters_t, Archive = boost::archive::text_oarchive]' test.cpp:16: instantiated from `std::string archive(T) [with T = parameters_t]' test.cpp:28: instantiated from here /usr/local/include/boost/archive/detail/oserializer.hpp:566: error: incomplete type `boost::STATIC_ASSERTION_FAILURE<false>' does not have member `value'
I'm not sure what to change. Is this correct behaviour?
S.