
Matthias Vallentin wrote:
Serializing a UUID into a boost::archive::binary_[io]archive works fine. However, when changing to a text archive, I get a compiler error with gcc 4.7 in C++11 mode on Darwin. Here is a small example:
#include
#include #include #include #include int main() { std::vector<char> v; boost::iostreams::filtering_ostream stream(boost::iostreams::back_inserter(v)); boost::archive::text_oarchive oa(stream);
boost::uuids::uuid id = boost::uuids::random_generator()(); oa << id;
return 0; }
The error is in basic_text_oprimitive line 92:
cannot bind 'std::basic_ostream<char>' lvalue to 'std::basic_ostream<char>&&'
Any ideas what's going on? (I attached the full error message below.)
Matthias
In file included from
/opt/local/include/boost/archive/text_oarchive.hpp:30:0, from test.cc:2: /opt/local/include/boost/archive/basic_text_oprimitive.hpp: In instantiation of 'void boost::archive::basic_text_oprimitive<OStream>::save(const T&) [with T = boost::uuids::uuid; OStream = std::basic_ostream<char>]':
This looks to me to some issue with boost::io_streams. Try your example with a regular stream (e.g. std::fostream). Robert Ramey