fix doc example typo
[boost.git] / boost / serialization / scoped_ptr.hpp
blob52642c7dc61e8ef07de0528854e7bd77bf3733ba
1 #ifndef BOOST_SERIALIZATION_SCOPED_PTR_HPP_VP_2003_10_30
2 #define BOOST_SERIALIZATION_SCOPED_PTR_HPP_VP_2003_10_30
4 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
5 # pragma once
6 #endif
8 // Copyright (c) 2003 Vladimir Prus.
9 // Use, modification and distribution is subject to the Boost Software
10 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
11 // http://www.boost.org/LICENSE_1_0.txt)
13 // Provides non-intrusive serialization for boost::scoped_ptr
14 // Does not allow to serialize scoped_ptr's to builtin types.
16 #include <boost/config.hpp>
18 #include <boost/scoped_ptr.hpp>
19 #include <boost/serialization/nvp.hpp>
20 #include <boost/serialization/split_free.hpp>
22 namespace boost {
23 namespace serialization {
25 template<class Archive, class T>
26 void save(
27 Archive & ar,
28 const boost::scoped_ptr<T> & t,
29 const unsigned int /* version */
31 T* r = t.get();
32 ar << boost::serialization::make_nvp("scoped_ptr", r);
35 template<class Archive, class T>
36 void load(
37 Archive & ar,
38 boost::scoped_ptr<T> & t,
39 const unsigned int /* version */
41 T* r;
42 ar >> boost::serialization::make_nvp("scoped_ptr", r);
43 t.reset(r);
46 template<class Archive, class T>
47 void serialize(
48 Archive& ar,
49 boost::scoped_ptr<T>& t,
50 const unsigned int version
52 boost::serialization::split_free(ar, t, version);
55 } // namespace serialization
56 } // namespace boost
58 #endif // BOOST_SERIALIZATION_SCOPED_PTR_HPP_VP_2003_10_30