Brian Silverman | 8867871 | 2018-08-04 23:56:48 -0700 | [diff] [blame^] | 1 | #ifndef BOOST_SERIALIZATION_EXAMPLE_DEMO_POLYMORPHIC_A_HPP |
| 2 | #define BOOST_SERIALIZATION_EXAMPLE_DEMO_POLYMORPHIC_A_HPP |
| 3 | |
| 4 | /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
| 5 | // demo_polymorphic_A.hpp |
| 6 | |
| 7 | // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . |
| 8 | // Use, modification and distribution is subject to the Boost Software |
| 9 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
| 10 | // http://www.boost.org/LICENSE_1_0.txt) |
| 11 | |
| 12 | namespace boost { |
| 13 | namespace archive { |
| 14 | |
| 15 | class polymorphic_iarchive; |
| 16 | class polymorphic_oarchive; |
| 17 | |
| 18 | } // namespace archive |
| 19 | } // namespace boost |
| 20 | |
| 21 | struct A { |
| 22 | // class a contains a pointer to a "hidden" declaration |
| 23 | template<class Archive> |
| 24 | void serialize( |
| 25 | Archive & ar, |
| 26 | const unsigned int file_version |
| 27 | ){ |
| 28 | ar & data; |
| 29 | } |
| 30 | int data; |
| 31 | bool operator==(const A & rhs) const { |
| 32 | return data == rhs.data; |
| 33 | } |
| 34 | A() : |
| 35 | data(0) |
| 36 | {} |
| 37 | }; |
| 38 | |
| 39 | #endif // BOOST_SERIALIZATION_EXAMPLE_DEMO_POLYMORPHIC_A_HPP |