12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef BOOST_SERIALIZATION_WEAK_PTR_HPP
- #define BOOST_SERIALIZATION_WEAK_PTR_HPP
- #if defined(_MSC_VER) && (_MSC_VER >= 1020)
- # pragma once
- #endif
- #include <boost/weak_ptr.hpp>
- #include <boost/serialization/shared_ptr.hpp>
- namespace boost {
- namespace serialization{
- template<class Archive, class T>
- inline void save(
- Archive & ar,
- const boost::weak_ptr<T> &t,
- const unsigned int
- ){
- const boost::shared_ptr<T> sp = t.lock();
- ar << boost::serialization::make_nvp("shared_ptr", sp);
- }
- template<class Archive, class T>
- inline void load(
- Archive & ar,
- boost::weak_ptr<T> &t,
- const unsigned int
- ){
- boost::shared_ptr<T> sp;
- ar >> boost::serialization::make_nvp("shared_ptr", sp);
- t = sp;
- }
- template<class Archive, class T>
- inline void serialize(
- Archive & ar,
- boost::weak_ptr<T> &t,
- const unsigned int file_version
- ){
- boost::serialization::split_free(ar, t, file_version);
- }
- }
- }
- #endif
|