Boost logo

Boost Users :

Subject: [Boost-users] How to use boost serialization and standard arrays?
From: D. R. Evans (doc.evans_at_[hidden])
Date: 2012-12-29 22:05:33


I've spent quite a bit of time searching and reading, but I can't understand
why the following is happening.

Given a simple function:

(non-boost headers)
.
.
.
#include <boost/archive/binary_oarchive.hpp>
#include <boost/serialization/array.hpp>
.
.
.
void archive_data(void)
{ ofstream ofs(context.archive_name());
  boost::archive::binary_oarchive ar(ofs);

  array<int, 10> test;

  ar << test;
}

I get:
  /usr/include/boost/serialization/access.hpp:118:9: error: ‘struct
std::array<int, 10u>’ has no member named ‘serialize’

----
The documentation says:
> This group of headers includes templates which implement serialization for 
> Standard Library or Boost Library templates. Any program which uses these 
> templates can invoke serialization of objects of these types just by
> including the corresponding header.
But it seems that including <boost/serialization/array.hpp> is insufficient.
What am I missing?
(Of course, in practice I'm not doing this with simple ints, but I've
simplified greatly to get to the above example, which still fails.) This is my
first attempt at using boost serialization, so I expect I've just
misunderstood something quite simple.
  Doc Evans
-- 
Web:  http://www.sff.net/people/N7DR



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