test_const_save_warn4_nvp.cpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
  2. // test_const.cpp
  3. // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
  4. // Use, modification and distribution is subject to the Boost Software
  5. // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. // http://www.boost.org/LICENSE_1_0.txt)
  7. // compile only
  8. #include <boost/archive/text_oarchive.hpp>
  9. #include <boost/serialization/nvp.hpp>
  10. using namespace boost::archive;
  11. struct A {
  12. template<class Archive>
  13. void serialize(Archive & ar, unsigned int version) {
  14. }
  15. };
  16. // comment out this test case as a reminder not to keep inserting it !!!
  17. // we don't trap this as an error in order to permit things like
  18. // X * xptr;
  19. // save(..){
  20. // ar << xptr;
  21. // }
  22. //
  23. // for rational - consider the following example from demo.cpp
  24. //
  25. // std::list<pair<trip_info, bus_route_info *> > schedule
  26. //
  27. // its not obvious to me how this can be cast to:
  28. //
  29. // std::list<pair<trip_info, const bus_route_info * const> > schedule
  30. void f4(text_oarchive & oa, A * const & a){
  31. oa << BOOST_SERIALIZATION_NVP(a);
  32. }