demo_polymorphic_A.hpp 1.0 KB

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