Boost logo

Boost Users :

From: Robert Ramey (ramey_at_[hidden])
Date: 2006-03-15 00:37:52


the << operator can only be used for "const" objects - the
& operator can be used for anything.

This is explained in the "rationale" section of the documentation.

Robert Ramey

Max Schoebinger wrote:
> Hi everybody,
>
> I am new to the serialization library and encountered a simple problem
> which I couldn't solve. I'd like to serialize simple stl containers. A
> minimal example is
>
> #include <fstream>
> #include <list>
> #include <boost/serialization/list.hpp>
> #include <boost/archive/text_oarchive.hpp>
>
> int main(int argc, char** argv)
> {
> typedef std::list<int> List;
>
> List myList;
> myList.push_back(1);
> myList.push_back(2);
> myList.push_back(3);
> myList.push_back(4);
> std::ofstream ofs("archive.txt");
> boost::archive::text_oarchive oa(ofs);
> oa << myList;
> }
>
> This doesn't compile under Linux using gcc-3.3 and boost-1.33.1 giving
> the following compiler error:
>
> /opt/toolkits/linux32/gcc-3.3/boost-1-33-1/include/boost-1_33_1/boost/archive/detail/oserializer.hpp:567:
> error: incomplete type `boost::STATIC_ASSERTION_FAILURE<false>' does
> not have member `value'
>
> Looking at the code at the given position hints that the type which
> should be serialized should be marked as track_never. I added the
> following command below the typedef of List
>
> BOOST_CLASS_TRACKING(List, boost::serialization::track_never)
>
> which also doesn't solve the problem...
>
> Maybe I am missing something very basic. I would be very thankful, if
> somebody could lift the curtain in front of my eyes ;-)
>
> Best Regards,
>
> Max


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