1 #ifndef BOOST_SERIALIZATION_TEST_J_HPP 2 #define BOOST_SERIALIZATION_TEST_J_HPP 3 4 // MS compatible compilers support #pragma once 5 #if defined(_MSC_VER) 6 # pragma once 7 #endif 8 9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 10 // J.hpp simple class test 11 12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com . 13 // Use, modification and distribution is subject to the Boost Software 14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 15 // http://www.boost.org/LICENSE_1_0.txt) 16 17 // See http://www.boost.org for updates, documentation, and revision history. 18 19 #include <boost/serialization/base_object.hpp> 20 21 #include "A.hpp" 22 23 /////////////////////////////////////////////////////// 24 // class with a member which refers to itself 25 class J : public A 26 { 27 private: 28 friend class boost::serialization::access; 29 template<class Archive> serialize(Archive & ar,const unsigned int)30 void serialize( 31 Archive &ar, 32 const unsigned int /* file_version */ 33 ){ 34 ar & BOOST_SERIALIZATION_BASE_OBJECT_NVP(A); 35 ar & BOOST_SERIALIZATION_NVP(j); 36 } 37 public: 38 bool operator==(const J &rhs) const; 39 J *j; J(J * _j)40 J(J *_j) : j(_j) {} J()41 J() : j(NULL){} 42 }; 43 44 BOOST_CLASS_VERSION(J, 6) 45 operator ==(const J & rhs) const46bool J::operator==(const J &rhs) const 47 { 48 return static_cast<const A &>(*this) == static_cast<const A &>(rhs); 49 } 50 51 #endif // BOOST_SERIALIZATION_TEST_J_HPP 52