If I build the boost demo_auto_ptr example from
http://www.boost.org/libs/serialization/example/demo_auto_ptr.cpp
it works fine. But if I change my code (see attach) it doesnt't compile.
The main difference in my code from boost's sample is that I don't use
save() and load() functions. If I add and call them it works fine.
The reason my code doesn't compile is that I get BOOST_STATIC_ASSERT.
Compiler (VC 7.1 and VC 8.0) points to the code:
template
Why my code doesn't compile
To find out, read the "rationale" section of the documentatio and what should I do to build it? //--------------------------------------------------- int main(int argc, char *argv[]) { // create a new auto pointer to ta new object of type A const std::auto_ptr<A> spa(new A); // note const here! // serialize it std::ofstream ofs("auto_ptr.txt"); boost::archive::text_oarchive oa(ofs); oa << spa; return 0; } Robert Ramey
participants (2)
-
Denis Kuznetsov
-
Robert Ramey