Boost logo

Boost Users :

Subject: [Boost-users] [Serialization] #include order
From: dariomt_at_[hidden]
Date: 2010-07-28 05:10:58

Hi all,

Compiling the following program with Boost 1.42 fires an static assertion in
boost/serialization/shared_ptr.hpp:153. This is expected.

But if I change the order of includes (compile with -DCHANGE) the assertion
fires in boost/serialization/shared_ptr.hpp:121. The assertion is expected
but I found it strange that I end up compiling a different part of the same

The code in that section seems related to serialization of shared_ptr in
version 1_32, but since I'm not able to understand the difference, I'm just
reporting it in case the order of #includes might affect how shared_ptr's
get serialized.


#include <boost/shared_ptr.hpp>

#ifndef CHANGE
#include <boost/serialization/shared_ptr.hpp>

#include <boost/archive/xml_oarchive.hpp>
#include <boost/archive/xml_iarchive.hpp>

#ifdef CHANGE
#include <boost/serialization/shared_ptr.hpp>

void test()
    boost::shared_ptr<int> p (new int); *p = 12345;

    boost::archive::xml_iarchive ia(std::cin);
    boost::serialization::load(ia, p, 0);

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at