Mercurial > hg > vamp-build-and-test
comparison DEPENDENCIES/generic/include/boost/multi_index/member.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 /* Copyright 2003-2008 Joaquin M Lopez Munoz. | 1 /* Copyright 2003-2013 Joaquin M Lopez Munoz. |
2 * Distributed under the Boost Software License, Version 1.0. | 2 * Distributed under the Boost Software License, Version 1.0. |
3 * (See accompanying file LICENSE_1_0.txt or copy at | 3 * (See accompanying file LICENSE_1_0.txt or copy at |
4 * http://www.boost.org/LICENSE_1_0.txt) | 4 * http://www.boost.org/LICENSE_1_0.txt) |
5 * | 5 * |
6 * See http://www.boost.org/libs/multi_index for library home page. | 6 * See http://www.boost.org/libs/multi_index for library home page. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef BOOST_MULTI_INDEX_MEMBER_HPP | 9 #ifndef BOOST_MULTI_INDEX_MEMBER_HPP |
10 #define BOOST_MULTI_INDEX_MEMBER_HPP | 10 #define BOOST_MULTI_INDEX_MEMBER_HPP |
11 | 11 |
12 #if defined(_MSC_VER)&&(_MSC_VER>=1200) | 12 #if defined(_MSC_VER) |
13 #pragma once | 13 #pragma once |
14 #endif | 14 #endif |
15 | 15 |
16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ | 16 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ |
17 #include <boost/mpl/if.hpp> | 17 #include <boost/mpl/if.hpp> |
39 * *...n...*x is convertible to T&, for some n>=1. | 39 * *...n...*x is convertible to T&, for some n>=1. |
40 * Examples of chained pointers are raw and smart pointers, iterators and | 40 * Examples of chained pointers are raw and smart pointers, iterators and |
41 * arbitrary combinations of these (vg. T** or auto_ptr<T*>.) | 41 * arbitrary combinations of these (vg. T** or auto_ptr<T*>.) |
42 */ | 42 */ |
43 | 43 |
44 /* NB. Some overloads of operator() have an extra dummy parameter int=0. | |
45 * This disambiguator serves several purposes: | |
46 * - Without it, MSVC++ 6.0 incorrectly regards some overloads as | |
47 * specializations of a previous member function template. | |
48 * - MSVC++ 6.0/7.0 seem to incorrectly treat some different memfuns | |
49 * as if they have the same signature. | |
50 * - If remove_const is broken due to lack of PTS, int=0 avoids the | |
51 * declaration of memfuns with identical signature. | |
52 */ | |
53 | |
54 template<class Class,typename Type,Type Class::*PtrToMember> | 44 template<class Class,typename Type,Type Class::*PtrToMember> |
55 struct const_member_base | 45 struct const_member_base |
56 { | 46 { |
57 typedef Type result_type; | 47 typedef Type result_type; |
58 | 48 |
78 Type& operator()(const reference_wrapper<const Class>& x)const | 68 Type& operator()(const reference_wrapper<const Class>& x)const |
79 { | 69 { |
80 return operator()(x.get()); | 70 return operator()(x.get()); |
81 } | 71 } |
82 | 72 |
83 Type& operator()(const reference_wrapper<Class>& x,int=0)const | 73 Type& operator()(const reference_wrapper<Class>& x)const |
84 { | 74 { |
85 return operator()(x.get()); | 75 return operator()(x.get()); |
86 } | 76 } |
87 }; | 77 }; |
88 | 78 |
103 operator()(const ChainedPtr& x)const | 93 operator()(const ChainedPtr& x)const |
104 { | 94 { |
105 return operator()(*x); | 95 return operator()(*x); |
106 } | 96 } |
107 | 97 |
108 const Type& operator()(const Class& x,int=0)const | 98 const Type& operator()(const Class& x)const |
109 { | 99 { |
110 return x.*PtrToMember; | 100 return x.*PtrToMember; |
111 } | 101 } |
112 | 102 |
113 Type& operator()(Class& x)const | 103 Type& operator()(Class& x)const |
114 { | 104 { |
115 return x.*PtrToMember; | 105 return x.*PtrToMember; |
116 } | 106 } |
117 | 107 |
118 const Type& operator()(const reference_wrapper<const Class>& x,int=0)const | 108 const Type& operator()(const reference_wrapper<const Class>& x)const |
119 { | 109 { |
120 return operator()(x.get()); | 110 return operator()(x.get()); |
121 } | 111 } |
122 | 112 |
123 Type& operator()(const reference_wrapper<Class>& x)const | 113 Type& operator()(const reference_wrapper<Class>& x)const |
150 * so it serves as a workaround in this compiler for all practical | 140 * so it serves as a workaround in this compiler for all practical |
151 * purposes. | 141 * purposes. |
152 * Surprisingly enough, other compilers, like Intel C++ 7.0/7.1 and | 142 * Surprisingly enough, other compilers, like Intel C++ 7.0/7.1 and |
153 * Visual Age 6.0, have similar bugs. This replacement of member<> | 143 * Visual Age 6.0, have similar bugs. This replacement of member<> |
154 * can be used for them too. | 144 * can be used for them too. |
145 * | |
146 * Support for such old compilers is dropped and | |
147 * [non_]const_member_offset_base is deprecated. | |
155 */ | 148 */ |
156 | 149 |
157 template<class Class,typename Type,std::size_t OffsetOfMember> | 150 template<class Class,typename Type,std::size_t OffsetOfMember> |
158 struct const_member_offset_base | 151 struct const_member_offset_base |
159 { | 152 { |
184 Type& operator()(const reference_wrapper<const Class>& x)const | 177 Type& operator()(const reference_wrapper<const Class>& x)const |
185 { | 178 { |
186 return operator()(x.get()); | 179 return operator()(x.get()); |
187 } | 180 } |
188 | 181 |
189 Type& operator()(const reference_wrapper<Class>& x,int=0)const | 182 Type& operator()(const reference_wrapper<Class>& x)const |
190 { | 183 { |
191 return operator()(x.get()); | 184 return operator()(x.get()); |
192 } | 185 } |
193 }; | 186 }; |
194 | 187 |
209 operator()(const ChainedPtr& x)const | 202 operator()(const ChainedPtr& x)const |
210 { | 203 { |
211 return operator()(*x); | 204 return operator()(*x); |
212 } | 205 } |
213 | 206 |
214 const Type& operator()(const Class& x,int=0)const | 207 const Type& operator()(const Class& x)const |
215 { | 208 { |
216 return *static_cast<const Type*>( | 209 return *static_cast<const Type*>( |
217 static_cast<const void*>( | 210 static_cast<const void*>( |
218 static_cast<const char*>( | 211 static_cast<const char*>( |
219 static_cast<const void *>(&x))+OffsetOfMember)); | 212 static_cast<const void *>(&x))+OffsetOfMember)); |
224 return *static_cast<Type*>( | 217 return *static_cast<Type*>( |
225 static_cast<void*>( | 218 static_cast<void*>( |
226 static_cast<char*>(static_cast<void *>(&x))+OffsetOfMember)); | 219 static_cast<char*>(static_cast<void *>(&x))+OffsetOfMember)); |
227 } | 220 } |
228 | 221 |
229 const Type& operator()(const reference_wrapper<const Class>& x,int=0)const | 222 const Type& operator()(const reference_wrapper<const Class>& x)const |
230 { | 223 { |
231 return operator()(x.get()); | 224 return operator()(x.get()); |
232 } | 225 } |
233 | 226 |
234 Type& operator()(const reference_wrapper<Class>& x)const | 227 Type& operator()(const reference_wrapper<Class>& x)const |