Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/serialization/weak_ptr.hpp @ 101:c530137014c0
Update Boost headers (1.58.0)
author | Chris Cannam |
---|---|
date | Mon, 07 Sep 2015 11:12:49 +0100 |
parents | 2665513ce2d3 |
children |
comparison
equal
deleted
inserted
replaced
100:793467b5e61c | 101:c530137014c0 |
---|---|
1 #ifndef BOOST_SERIALIZATION_WEAK_PTR_HPP | 1 #ifndef BOOST_SERIALIZATION_WEAK_PTR_HPP |
2 #define BOOST_SERIALIZATION_WEAK_PTR_HPP | 2 #define BOOST_SERIALIZATION_WEAK_PTR_HPP |
3 | 3 |
4 // MS compatible compilers support #pragma once | 4 // MS compatible compilers support #pragma once |
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020) | 5 #if defined(_MSC_VER) |
6 # pragma once | 6 # pragma once |
7 #endif | 7 #endif |
8 | 8 |
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 | 9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 |
10 // shared_ptr.hpp: serialization for boost shared pointer | 10 // weak_ptr.hpp: serialization for boost weak pointer |
11 | 11 |
12 // (C) Copyright 2004 Robert Ramey and Martin Ecker | 12 // (C) Copyright 2004 Robert Ramey and Martin Ecker |
13 // Use, modification and distribution is subject to the Boost Software | 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 | 14 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
15 // http://www.boost.org/LICENSE_1_0.txt) | 15 // http://www.boost.org/LICENSE_1_0.txt) |
53 } | 53 } |
54 | 54 |
55 } // namespace serialization | 55 } // namespace serialization |
56 } // namespace boost | 56 } // namespace boost |
57 | 57 |
58 #ifndef BOOST_NO_CXX11_SMART_PTR | |
59 #include <memory> | |
60 | |
61 namespace boost { | |
62 namespace serialization{ | |
63 | |
64 template<class Archive, class T> | |
65 inline void save( | |
66 Archive & ar, | |
67 const std::weak_ptr< T > &t, | |
68 const unsigned int /* file_version */ | |
69 ){ | |
70 const std::shared_ptr< T > sp = t.lock(); | |
71 ar << boost::serialization::make_nvp("weak_ptr", sp); | |
72 } | |
73 | |
74 template<class Archive, class T> | |
75 inline void load( | |
76 Archive & ar, | |
77 std::weak_ptr< T > &t, | |
78 const unsigned int /* file_version */ | |
79 ){ | |
80 std::shared_ptr< T > sp; | |
81 ar >> boost::serialization::make_nvp("weak_ptr", sp); | |
82 t = sp; | |
83 } | |
84 | |
85 template<class Archive, class T> | |
86 inline void serialize( | |
87 Archive & ar, | |
88 std::weak_ptr< T > &t, | |
89 const unsigned int file_version | |
90 ){ | |
91 boost::serialization::split_free(ar, t, file_version); | |
92 } | |
93 | |
94 } // namespace serialization | |
95 } // namespace boost | |
96 | |
97 #endif // BOOST_NO_CXX11_SMART_PTR | |
98 | |
58 #endif // BOOST_SERIALIZATION_WEAK_PTR_HPP | 99 #endif // BOOST_SERIALIZATION_WEAK_PTR_HPP |