Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.


// polymorphic_derived2.cpp   

// (C) Copyright 2002 Robert Ramey - . 
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at

//  See for updates, documentation, and revision history.

#include <boost/serialization/type_info_implementation.hpp>
#include <boost/serialization/extended_type_info_no_rtti.hpp>
#include <boost/serialization/export.hpp>

#include "polymorphic_derived2.hpp"

template<class Archive>
void polymorphic_derived2::serialize(
    Archive &ar, 
    const unsigned int /* file_version */
    ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(polymorphic_base);

// instantiate code for text archives
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>

template EXPORT_DECL(void) polymorphic_derived2::serialize(
    boost::archive::text_oarchive & ar,
    const unsigned int version
template EXPORT_DECL(void) polymorphic_derived2::serialize(
    boost::archive::text_iarchive & ar,
    const unsigned int version

// instantiate code for polymorphic archives
#include <boost/archive/polymorphic_iarchive.hpp>
#include <boost/archive/polymorphic_oarchive.hpp>

template EXPORT_DECL(void) polymorphic_derived2::serialize(
    boost::archive::polymorphic_oarchive & ar,
    const unsigned int version
template EXPORT_DECL(void) polymorphic_derived2::serialize(
    boost::archive::polymorphic_iarchive & ar,
    const unsigned int version

// MWerks users can do this to make their code work
BOOST_SERIALIZATION_MWERKS_BASE_AND_DERIVED(polymorphic_base, polymorphic_derived2)

// note: export has to be AFTER #includes for all archive classes

#if 0
#include <boost/serialization/factory.hpp>

EXPORT_DECL(polymorphic_derived2 *)
boost::serialization::factory<polymorphic_derived2, 0>(std::va_list ap);