fix doc example typo
[boost.git] / boost / serialization / ephemeral.hpp
blobf559bec99f5bb8051807537361edd0e3ba908b52
1 #ifndef BOOST_SERIALIZATION_EPHEMERAL_HPP
2 #define BOOST_SERIALIZATION_EPHEMERAL_HPP
4 // MS compatible compilers support
5 #pragma once
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
7 # pragma once
8 #endif
10 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
11 // ephemeral_object.hpp: interface for serialization system.
13 // (C) Copyright 2007 Matthias Troyer.
14 // Use, modification and distribution is subject to the Boost Software
15 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
16 // http://www.boost.org/LICENSE_1_0.txt)
18 // See http://www.boost.org for updates, documentation, and revision history.
20 #include <utility>
22 #include <boost/config.hpp>
23 #include <boost/detail/workaround.hpp>
24 // supress noise
25 #if BOOST_WORKAROUND(BOOST_MSVC, <= 1200)
26 # pragma warning (disable : 4786) // too long name, harmless warning
27 #endif
29 #include <boost/mpl/integral_c.hpp>
30 #include <boost/mpl/integral_c_tag.hpp>
32 #include <boost/serialization/level.hpp>
33 #include <boost/serialization/tracking.hpp>
34 #include <boost/serialization/split_member.hpp>
35 #include <boost/serialization/base_object.hpp>
36 #include <boost/serialization/traits.hpp>
37 #include <boost/serialization/wrapper.hpp>
39 namespace boost {
40 namespace serialization {
42 template<class T>
43 struct ephemeral_object :
44 public wrapper_traits<ephemeral_object<T> >
46 explicit ephemeral_object(T& t) :
47 val(t)
50 T & value() const {
51 return val;
54 const T & const_value() const {
55 return val;
58 template<class Archive>
59 void serialize(Archive &ar, const unsigned int) const
61 ar & val;
64 private:
65 T & val;
68 template<class T>
69 inline
70 #ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
71 const
72 #endif
73 ephemeral_object<T> ephemeral(const char * name, T & t){
74 return ephemeral_object<T>(name, t);
77 } // seralization
78 } // boost
80 #endif // BOOST_SERIALIZATION_EPHEMERAL_HPP