comparison DEPENDENCIES/generic/include/boost/serialization/base_object.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_BASE_OBJECT_HPP 1 #ifndef BOOST_SERIALIZATION_BASE_OBJECT_HPP
2 #define BOOST_SERIALIZATION_BASE_OBJECT_HPP 2 #define BOOST_SERIALIZATION_BASE_OBJECT_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 // base_object.hpp: 10 // base_object.hpp:
46 // get the base type for a given derived type 46 // get the base type for a given derived type
47 // preserving the const-ness 47 // preserving the const-ness
48 template<class B, class D> 48 template<class B, class D>
49 struct base_cast 49 struct base_cast
50 { 50 {
51 typedef BOOST_DEDUCED_TYPENAME 51 typedef typename
52 mpl::if_< 52 mpl::if_<
53 is_const<D>, 53 is_const<D>,
54 const B, 54 const B,
55 B 55 B
56 >::type type; 56 >::type type;
72 static void const * invoke(){ 72 static void const * invoke(){
73 return 0; 73 return 0;
74 } 74 }
75 }; 75 };
76 static void const * invoke(){ 76 static void const * invoke(){
77 typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< 77 typedef typename mpl::eval_if<
78 is_polymorphic<Base>, 78 is_polymorphic<Base>,
79 mpl::identity<polymorphic>, 79 mpl::identity<polymorphic>,
80 mpl::identity<non_polymorphic> 80 mpl::identity<non_polymorphic>
81 >::type type; 81 >::type type;
82 return type::invoke(); 82 return type::invoke();
93 detail::base_register<Base, Derived>::invoke(); 93 detail::base_register<Base, Derived>::invoke();
94 return access::cast_reference<const Base, Derived>(d); 94 return access::cast_reference<const Base, Derived>(d);
95 } 95 }
96 #else 96 #else
97 template<class Base, class Derived> 97 template<class Base, class Derived>
98 BOOST_DEDUCED_TYPENAME detail::base_cast<Base, Derived>::type & 98 typename detail::base_cast<Base, Derived>::type &
99 base_object(Derived &d) 99 base_object(Derived &d)
100 { 100 {
101 BOOST_STATIC_ASSERT(( is_base_and_derived<Base,Derived>::value)); 101 BOOST_STATIC_ASSERT(( is_base_and_derived<Base,Derived>::value));
102 BOOST_STATIC_ASSERT(! is_pointer<Derived>::value); 102 BOOST_STATIC_ASSERT(! is_pointer<Derived>::value);
103 typedef BOOST_DEDUCED_TYPENAME detail::base_cast<Base, Derived>::type type; 103 typedef typename detail::base_cast<Base, Derived>::type type;
104 detail::base_register<type, Derived>::invoke(); 104 detail::base_register<type, Derived>::invoke();
105 return access::cast_reference<type, Derived>(d); 105 return access::cast_reference<type, Derived>(d);
106 } 106 }
107 #endif 107 #endif
108 108