fix doc example typo
[boost.git] / boost / serialization / type_info_implementation.hpp
blob0dbdcd55a82915b57002a1be1d50613788bd5da2
1 #ifndef BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP
2 #define BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP
4 // MS compatible compilers support #pragma once
5 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
6 # pragma once
7 #endif
9 /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10 // type_info_implementation.hpp: interface for portable version of type_info
12 // (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
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
15 // http://www.boost.org/LICENSE_1_0.txt)
17 // See http://www.boost.org for updates, documentation, and revision history.
20 #include <boost/config.hpp>
21 #include <boost/detail/workaround.hpp>
23 #include <boost/static_assert.hpp>
24 #include <boost/mpl/eval_if.hpp>
25 #include <boost/mpl/identity.hpp>
26 #include <boost/type_traits/is_base_and_derived.hpp>
27 #include <boost/serialization/traits.hpp>
29 namespace boost {
30 namespace serialization {
32 // note that T and const T are folded into const T so that
33 // there is only one table entry per type
34 template<class T>
35 struct type_info_implementation {
36 template<class U>
37 struct traits_class_typeinfo_implementation {
38 typedef BOOST_DEDUCED_TYPENAME U::type_info_implementation::type type;
40 // note: at least one compiler complained w/o the full qualification
41 // on basic traits below
42 typedef
43 BOOST_DEDUCED_TYPENAME mpl::eval_if<
44 is_base_and_derived<boost::serialization::basic_traits, T>,
45 traits_class_typeinfo_implementation<T>,
46 //else
47 mpl::identity<
48 BOOST_DEDUCED_TYPENAME extended_type_info_impl<T>::type
50 >::type type;
53 } // namespace serialization
54 } // namespace boost
56 // define a macro to assign a particular derivation of extended_type_info
57 // to a specified a class.
58 #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x560))
59 #define BOOST_CLASS_TYPE_INFO(T, ETI) \
60 namespace boost { \
61 namespace serialization { \
62 template<> \
63 struct type_info_implementation< T > { \
64 typedef const ETI type; \
65 }; \
66 } \
67 } \
68 /**/
69 #else
70 #define BOOST_CLASS_TYPE_INFO(T, ETI) \
71 namespace boost { \
72 namespace serialization { \
73 template<> \
74 struct type_info_implementation< T > { \
75 typedef ETI type; \
76 }; \
77 template<> \
78 struct type_info_implementation< const T > { \
79 typedef ETI type; \
80 }; \
81 } \
82 } \
83 /**/
84 #endif
86 #endif /// BOOST_SERIALIZATION_TYPE_INFO_IMPLEMENTATION_HPP