annotate DEPENDENCIES/generic/include/boost/lambda/detail/member_ptr.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 // Boost Lambda Library -- member_ptr.hpp ---------------------
Chris@16 2
Chris@16 3 // Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi)
Chris@16 4 // Copyright (C) 2000 Gary Powell (gary.powell@sierra.com)
Chris@16 5 //
Chris@16 6 // Distributed under the Boost Software License, Version 1.0. (See
Chris@16 7 // accompanying file LICENSE_1_0.txt or copy at
Chris@16 8 // http://www.boost.org/LICENSE_1_0.txt)
Chris@16 9 //
Chris@16 10 // For more information, see www.boost.org
Chris@16 11
Chris@16 12 // --------------------------------------------------------------------------
Chris@16 13
Chris@16 14 #if !defined(BOOST_LAMBDA_MEMBER_PTR_HPP)
Chris@16 15 #define BOOST_LAMBDA_MEMBER_PTR_HPP
Chris@16 16
Chris@16 17 namespace boost {
Chris@16 18 namespace lambda {
Chris@16 19
Chris@16 20
Chris@16 21 class member_pointer_action {};
Chris@16 22
Chris@16 23
Chris@16 24 namespace detail {
Chris@16 25
Chris@16 26 // the boost type_traits member_pointer traits are not enough,
Chris@16 27 // need to know more details.
Chris@16 28 template<class T>
Chris@16 29 struct member_pointer {
Chris@16 30 typedef typename boost::add_reference<T>::type type;
Chris@16 31 typedef detail::unspecified class_type;
Chris@16 32 typedef detail::unspecified qualified_class_type;
Chris@16 33 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 34 BOOST_STATIC_CONSTANT(bool, is_function_member = false);
Chris@16 35 };
Chris@16 36
Chris@16 37 template<class T, class U>
Chris@16 38 struct member_pointer<T U::*> {
Chris@16 39 typedef typename boost::add_reference<T>::type type;
Chris@16 40 typedef U class_type;
Chris@16 41 typedef U qualified_class_type;
Chris@16 42 BOOST_STATIC_CONSTANT(bool, is_data_member = true);
Chris@16 43 BOOST_STATIC_CONSTANT(bool, is_function_member = false);
Chris@16 44 };
Chris@16 45
Chris@16 46 template<class T, class U>
Chris@16 47 struct member_pointer<const T U::*> {
Chris@16 48 typedef typename boost::add_reference<const T>::type type;
Chris@16 49 typedef U class_type;
Chris@16 50 typedef const U qualified_class_type;
Chris@16 51 BOOST_STATIC_CONSTANT(bool, is_data_member = true);
Chris@16 52 BOOST_STATIC_CONSTANT(bool, is_function_member = false);
Chris@16 53 };
Chris@16 54
Chris@16 55 template<class T, class U>
Chris@16 56 struct member_pointer<volatile T U::*> {
Chris@16 57 typedef typename boost::add_reference<volatile T>::type type;
Chris@16 58 typedef U class_type;
Chris@16 59 typedef volatile U qualified_class_type;
Chris@16 60 BOOST_STATIC_CONSTANT(bool, is_data_member = true);
Chris@16 61 BOOST_STATIC_CONSTANT(bool, is_function_member = false);
Chris@16 62 };
Chris@16 63
Chris@16 64 template<class T, class U>
Chris@16 65 struct member_pointer<const volatile T U::*> {
Chris@16 66 typedef typename boost::add_reference<const volatile T>::type type;
Chris@16 67 typedef U class_type;
Chris@16 68 typedef const volatile U qualified_class_type;
Chris@16 69 BOOST_STATIC_CONSTANT(bool, is_data_member = true);
Chris@16 70 BOOST_STATIC_CONSTANT(bool, is_function_member = false);
Chris@16 71 };
Chris@16 72
Chris@16 73 // -- nonconst member functions --
Chris@16 74 template<class T, class U>
Chris@16 75 struct member_pointer<T (U::*)()> {
Chris@16 76 typedef T type;
Chris@16 77 typedef U class_type;
Chris@16 78 typedef U qualified_class_type;
Chris@16 79 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 80 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 81 };
Chris@16 82 template<class T, class U, class A1>
Chris@16 83 struct member_pointer<T (U::*)(A1)> {
Chris@16 84 typedef T type;
Chris@16 85 typedef U class_type;
Chris@16 86 typedef U qualified_class_type;
Chris@16 87 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 88 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 89 };
Chris@16 90 template<class T, class U, class A1, class A2>
Chris@16 91 struct member_pointer<T (U::*)(A1, A2)> {
Chris@16 92 typedef T type;
Chris@16 93 typedef U class_type;
Chris@16 94 typedef U qualified_class_type;
Chris@16 95 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 96 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 97 };
Chris@16 98 template<class T, class U, class A1, class A2, class A3>
Chris@16 99 struct member_pointer<T (U::*)(A1, A2, A3)> {
Chris@16 100 typedef T type;
Chris@16 101 typedef U class_type;
Chris@16 102 typedef U qualified_class_type;
Chris@16 103 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 104 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 105 };
Chris@16 106 template<class T, class U, class A1, class A2, class A3, class A4>
Chris@16 107 struct member_pointer<T (U::*)(A1, A2, A3, A4)> {
Chris@16 108 typedef T type;
Chris@16 109 typedef U class_type;
Chris@16 110 typedef U qualified_class_type;
Chris@16 111 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 112 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 113 };
Chris@16 114 template<class T, class U, class A1, class A2, class A3, class A4, class A5>
Chris@16 115 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5)> {
Chris@16 116 typedef T type;
Chris@16 117 typedef U class_type;
Chris@16 118 typedef U qualified_class_type;
Chris@16 119 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 120 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 121 };
Chris@16 122 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 123 class A6>
Chris@16 124 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6)> {
Chris@16 125 typedef T type;
Chris@16 126 typedef U class_type;
Chris@16 127 typedef U qualified_class_type;
Chris@16 128 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 129 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 130 };
Chris@16 131 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 132 class A6, class A7>
Chris@16 133 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7)> {
Chris@16 134 typedef T type;
Chris@16 135 typedef U class_type;
Chris@16 136 typedef U qualified_class_type;
Chris@16 137 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 138 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 139 };
Chris@16 140 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 141 class A6, class A7, class A8>
Chris@16 142 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8)> {
Chris@16 143 typedef T type;
Chris@16 144 typedef U class_type;
Chris@16 145 typedef U qualified_class_type;
Chris@16 146 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 147 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 148 };
Chris@16 149 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 150 class A6, class A7, class A8, class A9>
Chris@16 151 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9)> {
Chris@16 152 typedef T type;
Chris@16 153 typedef U class_type;
Chris@16 154 typedef U qualified_class_type;
Chris@16 155 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 156 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 157 };
Chris@16 158 // -- const member functions --
Chris@16 159 template<class T, class U>
Chris@16 160 struct member_pointer<T (U::*)() const> {
Chris@16 161 typedef T type;
Chris@16 162 typedef U class_type;
Chris@16 163 typedef const U qualified_class_type;
Chris@16 164 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 165 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 166 };
Chris@16 167 template<class T, class U, class A1>
Chris@16 168 struct member_pointer<T (U::*)(A1) const> {
Chris@16 169 typedef T type;
Chris@16 170 typedef U class_type;
Chris@16 171 typedef const U qualified_class_type;
Chris@16 172 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 173 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 174 };
Chris@16 175 template<class T, class U, class A1, class A2>
Chris@16 176 struct member_pointer<T (U::*)(A1, A2) const> {
Chris@16 177 typedef T type;
Chris@16 178 typedef U class_type;
Chris@16 179 typedef const U qualified_class_type;
Chris@16 180 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 181 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 182 };
Chris@16 183 template<class T, class U, class A1, class A2, class A3>
Chris@16 184 struct member_pointer<T (U::*)(A1, A2, A3) const> {
Chris@16 185 typedef T type;
Chris@16 186 typedef U class_type;
Chris@16 187 typedef const U qualified_class_type;
Chris@16 188 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 189 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 190 };
Chris@16 191 template<class T, class U, class A1, class A2, class A3, class A4>
Chris@16 192 struct member_pointer<T (U::*)(A1, A2, A3, A4) const> {
Chris@16 193 typedef T type;
Chris@16 194 typedef U class_type;
Chris@16 195 typedef const U qualified_class_type;
Chris@16 196 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 197 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 198 };
Chris@16 199 template<class T, class U, class A1, class A2, class A3, class A4, class A5>
Chris@16 200 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) const> {
Chris@16 201 typedef T type;
Chris@16 202 typedef U class_type;
Chris@16 203 typedef const U qualified_class_type;
Chris@16 204 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 205 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 206 };
Chris@16 207 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 208 class A6>
Chris@16 209 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) const> {
Chris@16 210 typedef T type;
Chris@16 211 typedef U class_type;
Chris@16 212 typedef const U qualified_class_type;
Chris@16 213 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 214 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 215 };
Chris@16 216 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 217 class A6, class A7>
Chris@16 218 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) const> {
Chris@16 219 typedef T type;
Chris@16 220 typedef U class_type;
Chris@16 221 typedef const U qualified_class_type;
Chris@16 222 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 223 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 224 };
Chris@16 225 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 226 class A6, class A7, class A8>
Chris@16 227 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) const> {
Chris@16 228 typedef T type;
Chris@16 229 typedef U class_type;
Chris@16 230 typedef const U qualified_class_type;
Chris@16 231 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 232 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 233 };
Chris@16 234 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 235 class A6, class A7, class A8, class A9>
Chris@16 236 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const> {
Chris@16 237 typedef T type;
Chris@16 238 typedef U class_type;
Chris@16 239 typedef const U qualified_class_type;
Chris@16 240 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 241 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 242 };
Chris@16 243 // -- volatile --
Chris@16 244 template<class T, class U>
Chris@16 245 struct member_pointer<T (U::*)() volatile> {
Chris@16 246 typedef T type;
Chris@16 247 typedef U class_type;
Chris@16 248 typedef volatile U qualified_class_type;
Chris@16 249 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 250 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 251 };
Chris@16 252 template<class T, class U, class A1>
Chris@16 253 struct member_pointer<T (U::*)(A1) volatile> {
Chris@16 254 typedef T type;
Chris@16 255 typedef U class_type;
Chris@16 256 typedef volatile U qualified_class_type;
Chris@16 257 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 258 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 259 };
Chris@16 260 template<class T, class U, class A1, class A2>
Chris@16 261 struct member_pointer<T (U::*)(A1, A2) volatile> {
Chris@16 262 typedef T type;
Chris@16 263 typedef U class_type;
Chris@16 264 typedef volatile U qualified_class_type;
Chris@16 265 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 266 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 267 };
Chris@16 268 template<class T, class U, class A1, class A2, class A3>
Chris@16 269 struct member_pointer<T (U::*)(A1, A2, A3) volatile> {
Chris@16 270 typedef T type;
Chris@16 271 typedef U class_type;
Chris@16 272 typedef volatile U qualified_class_type;
Chris@16 273 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 274 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 275 };
Chris@16 276 template<class T, class U, class A1, class A2, class A3, class A4>
Chris@16 277 struct member_pointer<T (U::*)(A1, A2, A3, A4) volatile> {
Chris@16 278 typedef T type;
Chris@16 279 typedef U class_type;
Chris@16 280 typedef volatile U qualified_class_type;
Chris@16 281 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 282 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 283 };
Chris@16 284 template<class T, class U, class A1, class A2, class A3, class A4, class A5>
Chris@16 285 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) volatile> {
Chris@16 286 typedef T type;
Chris@16 287 typedef U class_type;
Chris@16 288 typedef volatile U qualified_class_type;
Chris@16 289 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 290 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 291 };
Chris@16 292 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 293 class A6>
Chris@16 294 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) volatile> {
Chris@16 295 typedef T type;
Chris@16 296 typedef U class_type;
Chris@16 297 typedef volatile U qualified_class_type;
Chris@16 298 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 299 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 300 };
Chris@16 301 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 302 class A6, class A7>
Chris@16 303 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) volatile> {
Chris@16 304 typedef T type;
Chris@16 305 typedef U class_type;
Chris@16 306 typedef volatile U qualified_class_type;
Chris@16 307 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 308 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 309 };
Chris@16 310 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 311 class A6, class A7, class A8>
Chris@16 312 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) volatile> {
Chris@16 313 typedef T type;
Chris@16 314 typedef U class_type;
Chris@16 315 typedef volatile U qualified_class_type;
Chris@16 316 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 317 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 318 };
Chris@16 319 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 320 class A6, class A7, class A8, class A9>
Chris@16 321 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) volatile> {
Chris@16 322 typedef T type;
Chris@16 323 typedef U class_type;
Chris@16 324 typedef volatile U qualified_class_type;
Chris@16 325 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 326 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 327 };
Chris@16 328 // -- const volatile
Chris@16 329 template<class T, class U>
Chris@16 330 struct member_pointer<T (U::*)() const volatile> {
Chris@16 331 typedef T type;
Chris@16 332 typedef U class_type;
Chris@16 333 typedef const volatile U qualified_class_type;
Chris@16 334 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 335 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 336 };
Chris@16 337 template<class T, class U, class A1>
Chris@16 338 struct member_pointer<T (U::*)(A1) const volatile> {
Chris@16 339 typedef T type;
Chris@16 340 typedef U class_type;
Chris@16 341 typedef const volatile U qualified_class_type;
Chris@16 342 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 343 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 344 };
Chris@16 345 template<class T, class U, class A1, class A2>
Chris@16 346 struct member_pointer<T (U::*)(A1, A2) const volatile> {
Chris@16 347 typedef T type;
Chris@16 348 typedef U class_type;
Chris@16 349 typedef const volatile U qualified_class_type;
Chris@16 350 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 351 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 352 };
Chris@16 353 template<class T, class U, class A1, class A2, class A3>
Chris@16 354 struct member_pointer<T (U::*)(A1, A2, A3) const volatile> {
Chris@16 355 typedef T type;
Chris@16 356 typedef U class_type;
Chris@16 357 typedef const volatile U qualified_class_type;
Chris@16 358 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 359 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 360 };
Chris@16 361 template<class T, class U, class A1, class A2, class A3, class A4>
Chris@16 362 struct member_pointer<T (U::*)(A1, A2, A3, A4) const volatile> {
Chris@16 363 typedef T type;
Chris@16 364 typedef U class_type;
Chris@16 365 typedef const volatile U qualified_class_type;
Chris@16 366 };
Chris@16 367 template<class T, class U, class A1, class A2, class A3, class A4, class A5>
Chris@16 368 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) const volatile> {
Chris@16 369 typedef T type;
Chris@16 370 typedef U class_type;
Chris@16 371 typedef const volatile U qualified_class_type;
Chris@16 372 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 373 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 374 };
Chris@16 375 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 376 class A6>
Chris@16 377 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) const volatile> {
Chris@16 378 typedef T type;
Chris@16 379 typedef U class_type;
Chris@16 380 typedef const volatile U qualified_class_type;
Chris@16 381 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 382 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 383 };
Chris@16 384 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 385 class A6, class A7>
Chris@16 386 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) const volatile> {
Chris@16 387 typedef T type;
Chris@16 388 typedef U class_type;
Chris@16 389 typedef const volatile U qualified_class_type;
Chris@16 390 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 391 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 392 };
Chris@16 393 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 394 class A6, class A7, class A8>
Chris@16 395 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) const volatile> {
Chris@16 396 typedef T type;
Chris@16 397 typedef U class_type;
Chris@16 398 typedef const volatile U qualified_class_type;
Chris@16 399 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 400 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 401 };
Chris@16 402 template<class T, class U, class A1, class A2, class A3, class A4, class A5,
Chris@16 403 class A6, class A7, class A8, class A9>
Chris@16 404 struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const volatile> {
Chris@16 405 typedef T type;
Chris@16 406 typedef U class_type;
Chris@16 407 typedef const volatile U qualified_class_type;
Chris@16 408 BOOST_STATIC_CONSTANT(bool, is_data_member = false);
Chris@16 409 BOOST_STATIC_CONSTANT(bool, is_function_member = true);
Chris@16 410 };
Chris@16 411
Chris@16 412 } // detail
Chris@16 413
Chris@16 414 namespace detail {
Chris@16 415
Chris@16 416 // this class holds a pointer to a member function and the object.
Chris@16 417 // when called, it just calls the member function with the parameters
Chris@16 418 // provided
Chris@16 419
Chris@16 420 // It would have been possible to use existing lambda_functors to represent
Chris@16 421 // a bound member function like this, but to have a separate template is
Chris@16 422 // safer, since now this functor doesn't mix and match with lambda_functors
Chris@16 423 // only thing you can do with this is to call it
Chris@16 424
Chris@16 425 // note that previously instantiated classes
Chris@16 426 // (other_action<member_pointer_action> and member_pointer_action_helper
Chris@16 427 // guarantee, that A and B are
Chris@16 428 // such types, that for objects a and b of corresponding types, a->*b leads
Chris@16 429 // to the builtin ->* to be called. So types that would end in a call to
Chris@16 430 // a user defined ->* do not create a member_pointer_caller object.
Chris@16 431
Chris@16 432 template<class RET, class A, class B>
Chris@16 433 class member_pointer_caller {
Chris@16 434 A a; B b;
Chris@16 435
Chris@16 436 public:
Chris@16 437 member_pointer_caller(const A& aa, const B& bb) : a(aa), b(bb) {}
Chris@16 438
Chris@16 439 RET operator()() const { return (a->*b)(); }
Chris@16 440
Chris@16 441 template<class A1>
Chris@16 442 RET operator()(const A1& a1) const { return (a->*b)(a1); }
Chris@16 443
Chris@16 444 template<class A1, class A2>
Chris@16 445 RET operator()(const A1& a1, const A2& a2) const { return (a->*b)(a1, a2); }
Chris@16 446
Chris@16 447 template<class A1, class A2, class A3>
Chris@16 448 RET operator()(const A1& a1, const A2& a2, const A3& a3) const {
Chris@16 449 return (a->*b)(a1, a2, a3);
Chris@16 450 }
Chris@16 451
Chris@16 452 template<class A1, class A2, class A3, class A4>
Chris@16 453 RET operator()(const A1& a1, const A2& a2, const A3& a3,
Chris@16 454 const A4& a4) const {
Chris@16 455 return (a->*b)(a1, a2, a3, a4);
Chris@16 456 }
Chris@16 457
Chris@16 458 template<class A1, class A2, class A3, class A4, class A5>
Chris@16 459 RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Chris@16 460 const A5& a5) const {
Chris@16 461 return (a->*b)(a1, a2, a3, a4, a5);
Chris@16 462 }
Chris@16 463
Chris@16 464 template<class A1, class A2, class A3, class A4, class A5, class A6>
Chris@16 465 RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Chris@16 466 const A5& a5, const A6& a6) const {
Chris@16 467 return (a->*b)(a1, a2, a3, a4, a5, a6);
Chris@16 468 }
Chris@16 469
Chris@16 470 template<class A1, class A2, class A3, class A4, class A5, class A6,
Chris@16 471 class A7>
Chris@16 472 RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Chris@16 473 const A5& a5, const A6& a6, const A7& a7) const {
Chris@16 474 return (a->*b)(a1, a2, a3, a4, a5, a6, a7);
Chris@16 475 }
Chris@16 476
Chris@16 477 template<class A1, class A2, class A3, class A4, class A5, class A6,
Chris@16 478 class A7, class A8>
Chris@16 479 RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Chris@16 480 const A5& a5, const A6& a6, const A7& a7,
Chris@16 481 const A8& a8) const {
Chris@16 482 return (a->*b)(a1, a2, a3, a4, a5, a6, a7, a8);
Chris@16 483 }
Chris@16 484
Chris@16 485 template<class A1, class A2, class A3, class A4, class A5, class A6,
Chris@16 486 class A7, class A8, class A9>
Chris@16 487 RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4,
Chris@16 488 const A5& a5, const A6& a6, const A7& a7,
Chris@16 489 const A8& a8, const A9& a9) const {
Chris@16 490 return (a->*b)(a1, a2, a3, a4, a5, a6, a7, a8, a9);
Chris@16 491 }
Chris@16 492
Chris@16 493 };
Chris@16 494
Chris@16 495 // helper templates for return type deduction and action classes
Chris@16 496 // different cases for data member, function member, neither
Chris@16 497
Chris@16 498 // true-true case
Chris@16 499 template <bool Is_data_member, bool Is_function_member>
Chris@16 500 struct member_pointer_action_helper;
Chris@16 501 // cannot be both, no body provided
Chris@16 502
Chris@16 503 // data member case
Chris@16 504 // this means, that B is a data member and A is a pointer type,
Chris@16 505 // so either built-in ->* should be called, or there is an error
Chris@16 506 template <>
Chris@16 507 struct member_pointer_action_helper<true, false> {
Chris@16 508 public:
Chris@16 509
Chris@16 510 template<class RET, class A, class B>
Chris@16 511 static RET apply(A& a, B& b) {
Chris@16 512 return a->*b;
Chris@16 513 }
Chris@16 514
Chris@16 515 template<class A, class B>
Chris@16 516 struct return_type {
Chris@16 517 private:
Chris@16 518 typedef typename detail::remove_reference_and_cv<B>::type plainB;
Chris@16 519
Chris@16 520 typedef typename detail::member_pointer<plainB>::type type0;
Chris@16 521 // we remove the reference now, as we may have to add cv:s
Chris@16 522 typedef typename boost::remove_reference<type0>::type type1;
Chris@16 523
Chris@16 524 // A is a reference to pointer
Chris@16 525 // remove the top level cv qualifiers and reference
Chris@16 526 typedef typename
Chris@16 527 detail::remove_reference_and_cv<A>::type non_ref_A;
Chris@16 528
Chris@16 529 // A is a pointer type, so take the type pointed to
Chris@16 530 typedef typename ::boost::remove_pointer<non_ref_A>::type non_pointer_A;
Chris@16 531
Chris@16 532 public:
Chris@16 533 // For non-reference types, we must add const and/or volatile if
Chris@16 534 // the pointer type has these qualifiers
Chris@16 535 // If the member is a reference, these do not have any effect
Chris@16 536 // (cv T == T if T is a reference type)
Chris@16 537 typedef typename detail::IF<
Chris@16 538 ::boost::is_const<non_pointer_A>::value,
Chris@16 539 typename ::boost::add_const<type1>::type,
Chris@16 540 type1
Chris@16 541 >::RET type2;
Chris@16 542 typedef typename detail::IF<
Chris@16 543 ::boost::is_volatile<non_pointer_A>::value,
Chris@16 544 typename ::boost::add_volatile<type2>::type,
Chris@16 545 type2
Chris@16 546 >::RET type3;
Chris@16 547 // add reference back
Chris@16 548 typedef typename ::boost::add_reference<type3>::type type;
Chris@16 549 };
Chris@16 550 };
Chris@16 551
Chris@16 552 // neither case
Chris@16 553 template <>
Chris@16 554 struct member_pointer_action_helper<false, false> {
Chris@16 555 public:
Chris@16 556 template<class RET, class A, class B>
Chris@16 557 static RET apply(A& a, B& b) {
Chris@16 558 // not a built in member pointer operator, just call ->*
Chris@16 559 return a->*b;
Chris@16 560 }
Chris@16 561 // an overloaded member pointer operators, user should have specified
Chris@16 562 // the return type
Chris@16 563 // At this point we know that there is no matching specialization for
Chris@16 564 // return_type_2, so try return_type_2_plain
Chris@16 565 template<class A, class B>
Chris@16 566 struct return_type {
Chris@16 567
Chris@16 568 typedef typename plain_return_type_2<
Chris@16 569 other_action<member_pointer_action>, A, B
Chris@16 570 >::type type;
Chris@16 571 };
Chris@16 572
Chris@16 573 };
Chris@16 574
Chris@16 575
Chris@16 576 // member pointer function case
Chris@16 577 // This is a built in ->* call for a member function,
Chris@16 578 // the only thing that you can do with that, is to give it some arguments
Chris@16 579 // note, it is guaranteed that A is a pointer type, and thus it cannot
Chris@16 580 // be a call to overloaded ->*
Chris@16 581 template <>
Chris@16 582 struct member_pointer_action_helper<false, true> {
Chris@16 583 public:
Chris@16 584
Chris@16 585 template<class RET, class A, class B>
Chris@16 586 static RET apply(A& a, B& b) {
Chris@16 587 typedef typename ::boost::remove_cv<B>::type plainB;
Chris@16 588 typedef typename detail::member_pointer<plainB>::type ret_t;
Chris@16 589 typedef typename ::boost::remove_cv<A>::type plainA;
Chris@16 590
Chris@16 591 // we always strip cv:s to
Chris@16 592 // make the two routes (calling and type deduction)
Chris@16 593 // to give the same results (and the const does not make any functional
Chris@16 594 // difference)
Chris@16 595 return detail::member_pointer_caller<ret_t, plainA, plainB>(a, b);
Chris@16 596 }
Chris@16 597
Chris@16 598 template<class A, class B>
Chris@16 599 struct return_type {
Chris@16 600 typedef typename detail::remove_reference_and_cv<B>::type plainB;
Chris@16 601 typedef typename detail::member_pointer<plainB>::type ret_t;
Chris@16 602 typedef typename detail::remove_reference_and_cv<A>::type plainA;
Chris@16 603
Chris@16 604 typedef detail::member_pointer_caller<ret_t, plainA, plainB> type;
Chris@16 605 };
Chris@16 606 };
Chris@16 607
Chris@16 608 } // detail
Chris@16 609
Chris@16 610 template<> class other_action<member_pointer_action> {
Chris@16 611 public:
Chris@16 612 template<class RET, class A, class B>
Chris@16 613 static RET apply(A& a, B& b) {
Chris@16 614 typedef typename
Chris@16 615 ::boost::remove_cv<B>::type plainB;
Chris@16 616
Chris@16 617 return detail::member_pointer_action_helper<
Chris@16 618 boost::is_pointer<A>::value &&
Chris@16 619 detail::member_pointer<plainB>::is_data_member,
Chris@16 620 boost::is_pointer<A>::value &&
Chris@16 621 detail::member_pointer<plainB>::is_function_member
Chris@16 622 >::template apply<RET>(a, b);
Chris@16 623 }
Chris@16 624 };
Chris@16 625
Chris@16 626 // return type deduction --
Chris@16 627
Chris@16 628 // If the right argument is a pointer to data member,
Chris@16 629 // and the left argument is of compatible pointer to class type
Chris@16 630 // return type is a reference to the data member type
Chris@16 631
Chris@16 632 // if right argument is a pointer to a member function, and the left
Chris@16 633 // argument is of a compatible type, the return type is a
Chris@16 634 // member_pointer_caller (see above)
Chris@16 635
Chris@16 636 // Otherwise, return type deduction fails. There is either an error,
Chris@16 637 // or the user is trying to call an overloaded ->*
Chris@16 638 // In such a case either ret<> must be used, or a return_type_2 user
Chris@16 639 // defined specialization must be provided
Chris@16 640
Chris@16 641
Chris@16 642 template<class A, class B>
Chris@16 643 struct return_type_2<other_action<member_pointer_action>, A, B> {
Chris@16 644 private:
Chris@16 645 typedef typename
Chris@16 646 detail::remove_reference_and_cv<B>::type plainB;
Chris@16 647 public:
Chris@16 648 typedef typename
Chris@16 649 detail::member_pointer_action_helper<
Chris@16 650 detail::member_pointer<plainB>::is_data_member,
Chris@16 651 detail::member_pointer<plainB>::is_function_member
Chris@16 652 >::template return_type<A, B>::type type;
Chris@16 653 };
Chris@16 654
Chris@16 655 // this is the way the generic lambda_functor_base functions instantiate
Chris@16 656 // return type deduction. We turn it into return_type_2, so that the
Chris@16 657 // user can provide specializations on that level.
Chris@16 658 template<class Args>
Chris@16 659 struct return_type_N<other_action<member_pointer_action>, Args> {
Chris@16 660 typedef typename boost::tuples::element<0, Args>::type A;
Chris@16 661 typedef typename boost::tuples::element<1, Args>::type B;
Chris@16 662 typedef typename
Chris@16 663 return_type_2<other_action<member_pointer_action>,
Chris@16 664 typename boost::remove_reference<A>::type,
Chris@16 665 typename boost::remove_reference<B>::type
Chris@16 666 >::type type;
Chris@16 667 };
Chris@16 668
Chris@16 669
Chris@16 670 template<class Arg1, class Arg2>
Chris@16 671 inline const
Chris@16 672 lambda_functor<
Chris@16 673 lambda_functor_base<
Chris@16 674 action<2, other_action<member_pointer_action> >,
Chris@16 675 tuple<lambda_functor<Arg1>, typename const_copy_argument<Arg2>::type>
Chris@16 676 >
Chris@16 677 >
Chris@16 678 operator->*(const lambda_functor<Arg1>& a1, const Arg2& a2)
Chris@16 679 {
Chris@16 680 return
Chris@16 681 lambda_functor_base<
Chris@16 682 action<2, other_action<member_pointer_action> >,
Chris@16 683 tuple<lambda_functor<Arg1>, typename const_copy_argument<Arg2>::type>
Chris@16 684 >
Chris@16 685 (tuple<lambda_functor<Arg1>,
Chris@16 686 typename const_copy_argument<Arg2>::type>(a1, a2));
Chris@16 687 }
Chris@16 688
Chris@16 689 template<class Arg1, class Arg2>
Chris@16 690 inline const
Chris@16 691 lambda_functor<
Chris@16 692 lambda_functor_base<
Chris@16 693 action<2, other_action<member_pointer_action> >,
Chris@16 694 tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
Chris@16 695 >
Chris@16 696 >
Chris@16 697 operator->*(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2)
Chris@16 698 {
Chris@16 699 return
Chris@16 700 lambda_functor_base<
Chris@16 701 action<2, other_action<member_pointer_action> >,
Chris@16 702 tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >
Chris@16 703 >
Chris@16 704 (tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2));
Chris@16 705 }
Chris@16 706
Chris@16 707 template<class Arg1, class Arg2>
Chris@16 708 inline const
Chris@16 709 lambda_functor<
Chris@16 710 lambda_functor_base<
Chris@16 711 action<2, other_action<member_pointer_action> >,
Chris@16 712 tuple<typename const_copy_argument<Arg1>::type, lambda_functor<Arg2> >
Chris@16 713 >
Chris@16 714 >
Chris@16 715 operator->*(const Arg1& a1, const lambda_functor<Arg2>& a2)
Chris@16 716 {
Chris@16 717 return
Chris@16 718 lambda_functor_base<
Chris@16 719 action<2, other_action<member_pointer_action> >,
Chris@16 720 tuple<typename const_copy_argument<Arg1>::type, lambda_functor<Arg2> >
Chris@16 721 >
Chris@16 722 (tuple<typename const_copy_argument<Arg1>::type,
Chris@16 723 lambda_functor<Arg2> >(a1, a2));
Chris@16 724 }
Chris@16 725
Chris@16 726
Chris@16 727 } // namespace lambda
Chris@16 728 } // namespace boost
Chris@16 729
Chris@16 730
Chris@16 731 #endif
Chris@16 732
Chris@16 733
Chris@16 734
Chris@16 735
Chris@16 736
Chris@16 737