1 2 // Copyright Peter Dimov 2001 3 // Copyright Aleksey Gurtovoy 2001-2004 4 // 5 // Distributed under the Boost Software License, Version 1.0. 6 // (See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt) 8 // 9 10 // Preprocessed version of "boost/mpl/bind.hpp" header 11 // -- DO NOT modify by hand! 12 13 namespace boost { namespace mpl { 14 15 namespace aux { 16 template< bool > 17 struct resolve_arg_impl 18 { 19 template< 20 typename T, typename U1, typename U2, typename U3 21 , typename U4, typename U5 22 > 23 struct result_ 24 { 25 typedef T type; 26 }; 27 }; 28 29 template<> 30 struct resolve_arg_impl<true> 31 { 32 template< 33 typename T, typename U1, typename U2, typename U3 34 , typename U4, typename U5 35 > 36 struct result_ 37 { 38 typedef typename apply_wrap5< 39 T 40 , U1, U2, U3, U4, U5 41 >::type type; 42 }; 43 }; 44 45 template< typename T > struct is_bind_template; 46 47 template< 48 typename T, typename U1, typename U2, typename U3, typename U4 49 , typename U5 50 > 51 struct resolve_bind_arg 52 : resolve_arg_impl< is_bind_template<T>::value > 53 ::template result_< T,U1,U2,U3,U4,U5 > 54 { 55 }; 56 57 template< typename T > 58 struct replace_unnamed_arg_impl 59 { 60 template< typename Arg > struct result_ 61 { 62 typedef Arg next; 63 typedef T type; 64 }; 65 }; 66 67 template<> 68 struct replace_unnamed_arg_impl< arg< -1 > > 69 { 70 template< typename Arg > struct result_ 71 { 72 typedef typename next<Arg>::type next; 73 typedef Arg type; 74 }; 75 }; 76 77 template< typename T, typename Arg > 78 struct replace_unnamed_arg 79 : replace_unnamed_arg_impl<T>::template result_<Arg> 80 { 81 }; 82 83 template< int arity_ > struct bind_chooser; 84 85 aux::no_tag is_bind_helper(...); 86 template< typename T > aux::no_tag is_bind_helper(protect<T>*); 87 88 template< 89 typename F, typename T1, typename T2, typename T3, typename T4 90 , typename T5 91 > 92 aux::yes_tag is_bind_helper(bind< F,T1,T2,T3,T4,T5 >*); 93 94 template< int N > 95 aux::yes_tag is_bind_helper(arg<N>*); 96 97 template< bool is_ref_ = true > 98 struct is_bind_template_impl 99 { 100 template< typename T > struct result_ 101 { 102 BOOST_STATIC_CONSTANT(bool, value = false); 103 }; 104 }; 105 106 template<> 107 struct is_bind_template_impl<false> 108 { 109 template< typename T > struct result_ 110 { 111 BOOST_STATIC_CONSTANT(bool, value = 112 sizeof(aux::is_bind_helper(static_cast<T*>(0))) 113 == sizeof(aux::yes_tag) 114 ); 115 }; 116 }; 117 118 template< typename T > struct is_bind_template 119 : is_bind_template_impl< ::boost::detail::is_reference_impl<T>::value > 120 ::template result_<T> 121 { 122 }; 123 124 } // namespace aux 125 126 template< 127 typename F 128 > 129 struct bind0 130 { 131 template< 132 typename U1 = na, typename U2 = na, typename U3 = na 133 , typename U4 = na, typename U5 = na 134 > 135 struct apply 136 { 137 private: 138 typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; 139 typedef typename r0::type a0; 140 typedef typename r0::next n1; 141 typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; 142 /// 143 public: 144 typedef typename apply_wrap0< 145 f_ 146 >::type type; 147 148 }; 149 }; 150 151 namespace aux { 152 153 template< 154 typename F 155 > 156 aux::yes_tag 157 is_bind_helper(bind0<F>*); 158 159 } // namespace aux 160 161 BOOST_MPL_AUX_ARITY_SPEC(1, bind0) 162 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(1, bind0) 163 164 namespace aux { 165 166 template<> 167 struct bind_chooser<0> 168 { 169 template< 170 typename F, typename T1, typename T2, typename T3, typename T4 171 , typename T5 172 > 173 struct result_ 174 { 175 typedef bind0<F> type; 176 }; 177 }; 178 179 } // namespace aux 180 181 template< 182 typename F, typename T1 183 > 184 struct bind1 185 { 186 template< 187 typename U1 = na, typename U2 = na, typename U3 = na 188 , typename U4 = na, typename U5 = na 189 > 190 struct apply 191 { 192 private: 193 typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; 194 typedef typename r0::type a0; 195 typedef typename r0::next n1; 196 typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; 197 /// 198 typedef aux::replace_unnamed_arg< T1,n1 > r1; 199 typedef typename r1::type a1; 200 typedef typename r1::next n2; 201 typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1; 202 /// 203 public: 204 typedef typename apply_wrap1< 205 f_ 206 , typename t1::type 207 >::type type; 208 209 }; 210 }; 211 212 namespace aux { 213 214 template< 215 typename F, typename T1 216 > 217 aux::yes_tag 218 is_bind_helper(bind1< F,T1 >*); 219 220 } // namespace aux 221 222 BOOST_MPL_AUX_ARITY_SPEC(2, bind1) 223 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(2, bind1) 224 225 namespace aux { 226 227 template<> 228 struct bind_chooser<1> 229 { 230 template< 231 typename F, typename T1, typename T2, typename T3, typename T4 232 , typename T5 233 > 234 struct result_ 235 { 236 typedef bind1< F,T1 > type; 237 }; 238 }; 239 240 } // namespace aux 241 242 template< 243 typename F, typename T1, typename T2 244 > 245 struct bind2 246 { 247 template< 248 typename U1 = na, typename U2 = na, typename U3 = na 249 , typename U4 = na, typename U5 = na 250 > 251 struct apply 252 { 253 private: 254 typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; 255 typedef typename r0::type a0; 256 typedef typename r0::next n1; 257 typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; 258 /// 259 typedef aux::replace_unnamed_arg< T1,n1 > r1; 260 typedef typename r1::type a1; 261 typedef typename r1::next n2; 262 typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1; 263 /// 264 typedef aux::replace_unnamed_arg< T2,n2 > r2; 265 typedef typename r2::type a2; 266 typedef typename r2::next n3; 267 typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2; 268 /// 269 public: 270 typedef typename apply_wrap2< 271 f_ 272 , typename t1::type, typename t2::type 273 >::type type; 274 275 }; 276 }; 277 278 namespace aux { 279 280 template< 281 typename F, typename T1, typename T2 282 > 283 aux::yes_tag 284 is_bind_helper(bind2< F,T1,T2 >*); 285 286 } // namespace aux 287 288 BOOST_MPL_AUX_ARITY_SPEC(3, bind2) 289 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(3, bind2) 290 291 namespace aux { 292 293 template<> 294 struct bind_chooser<2> 295 { 296 template< 297 typename F, typename T1, typename T2, typename T3, typename T4 298 , typename T5 299 > 300 struct result_ 301 { 302 typedef bind2< F,T1,T2 > type; 303 }; 304 }; 305 306 } // namespace aux 307 308 template< 309 typename F, typename T1, typename T2, typename T3 310 > 311 struct bind3 312 { 313 template< 314 typename U1 = na, typename U2 = na, typename U3 = na 315 , typename U4 = na, typename U5 = na 316 > 317 struct apply 318 { 319 private: 320 typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; 321 typedef typename r0::type a0; 322 typedef typename r0::next n1; 323 typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; 324 /// 325 typedef aux::replace_unnamed_arg< T1,n1 > r1; 326 typedef typename r1::type a1; 327 typedef typename r1::next n2; 328 typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1; 329 /// 330 typedef aux::replace_unnamed_arg< T2,n2 > r2; 331 typedef typename r2::type a2; 332 typedef typename r2::next n3; 333 typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2; 334 /// 335 typedef aux::replace_unnamed_arg< T3,n3 > r3; 336 typedef typename r3::type a3; 337 typedef typename r3::next n4; 338 typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3; 339 /// 340 public: 341 typedef typename apply_wrap3< 342 f_ 343 , typename t1::type, typename t2::type, typename t3::type 344 >::type type; 345 346 }; 347 }; 348 349 namespace aux { 350 351 template< 352 typename F, typename T1, typename T2, typename T3 353 > 354 aux::yes_tag 355 is_bind_helper(bind3< F,T1,T2,T3 >*); 356 357 } // namespace aux 358 359 BOOST_MPL_AUX_ARITY_SPEC(4, bind3) 360 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(4, bind3) 361 362 namespace aux { 363 364 template<> 365 struct bind_chooser<3> 366 { 367 template< 368 typename F, typename T1, typename T2, typename T3, typename T4 369 , typename T5 370 > 371 struct result_ 372 { 373 typedef bind3< F,T1,T2,T3 > type; 374 }; 375 }; 376 377 } // namespace aux 378 379 template< 380 typename F, typename T1, typename T2, typename T3, typename T4 381 > 382 struct bind4 383 { 384 template< 385 typename U1 = na, typename U2 = na, typename U3 = na 386 , typename U4 = na, typename U5 = na 387 > 388 struct apply 389 { 390 private: 391 typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; 392 typedef typename r0::type a0; 393 typedef typename r0::next n1; 394 typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; 395 /// 396 typedef aux::replace_unnamed_arg< T1,n1 > r1; 397 typedef typename r1::type a1; 398 typedef typename r1::next n2; 399 typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1; 400 /// 401 typedef aux::replace_unnamed_arg< T2,n2 > r2; 402 typedef typename r2::type a2; 403 typedef typename r2::next n3; 404 typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2; 405 /// 406 typedef aux::replace_unnamed_arg< T3,n3 > r3; 407 typedef typename r3::type a3; 408 typedef typename r3::next n4; 409 typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3; 410 /// 411 typedef aux::replace_unnamed_arg< T4,n4 > r4; 412 typedef typename r4::type a4; 413 typedef typename r4::next n5; 414 typedef aux::resolve_bind_arg< a4,U1,U2,U3,U4,U5 > t4; 415 /// 416 public: 417 typedef typename apply_wrap4< 418 f_ 419 , typename t1::type, typename t2::type, typename t3::type 420 , typename t4::type 421 >::type type; 422 423 }; 424 }; 425 426 namespace aux { 427 428 template< 429 typename F, typename T1, typename T2, typename T3, typename T4 430 > 431 aux::yes_tag 432 is_bind_helper(bind4< F,T1,T2,T3,T4 >*); 433 434 } // namespace aux 435 436 BOOST_MPL_AUX_ARITY_SPEC(5, bind4) 437 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(5, bind4) 438 439 namespace aux { 440 441 template<> 442 struct bind_chooser<4> 443 { 444 template< 445 typename F, typename T1, typename T2, typename T3, typename T4 446 , typename T5 447 > 448 struct result_ 449 { 450 typedef bind4< F,T1,T2,T3,T4 > type; 451 }; 452 }; 453 454 } // namespace aux 455 456 template< 457 typename F, typename T1, typename T2, typename T3, typename T4 458 , typename T5 459 > 460 struct bind5 461 { 462 template< 463 typename U1 = na, typename U2 = na, typename U3 = na 464 , typename U4 = na, typename U5 = na 465 > 466 struct apply 467 { 468 private: 469 typedef aux::replace_unnamed_arg< F, mpl::arg<1> > r0; 470 typedef typename r0::type a0; 471 typedef typename r0::next n1; 472 typedef typename aux::resolve_bind_arg< a0,U1,U2,U3,U4,U5 >::type f_; 473 /// 474 typedef aux::replace_unnamed_arg< T1,n1 > r1; 475 typedef typename r1::type a1; 476 typedef typename r1::next n2; 477 typedef aux::resolve_bind_arg< a1,U1,U2,U3,U4,U5 > t1; 478 /// 479 typedef aux::replace_unnamed_arg< T2,n2 > r2; 480 typedef typename r2::type a2; 481 typedef typename r2::next n3; 482 typedef aux::resolve_bind_arg< a2,U1,U2,U3,U4,U5 > t2; 483 /// 484 typedef aux::replace_unnamed_arg< T3,n3 > r3; 485 typedef typename r3::type a3; 486 typedef typename r3::next n4; 487 typedef aux::resolve_bind_arg< a3,U1,U2,U3,U4,U5 > t3; 488 /// 489 typedef aux::replace_unnamed_arg< T4,n4 > r4; 490 typedef typename r4::type a4; 491 typedef typename r4::next n5; 492 typedef aux::resolve_bind_arg< a4,U1,U2,U3,U4,U5 > t4; 493 /// 494 typedef aux::replace_unnamed_arg< T5,n5 > r5; 495 typedef typename r5::type a5; 496 typedef typename r5::next n6; 497 typedef aux::resolve_bind_arg< a5,U1,U2,U3,U4,U5 > t5; 498 /// 499 public: 500 typedef typename apply_wrap5< 501 f_ 502 , typename t1::type, typename t2::type, typename t3::type 503 , typename t4::type, typename t5::type 504 >::type type; 505 506 }; 507 }; 508 509 namespace aux { 510 511 template< 512 typename F, typename T1, typename T2, typename T3, typename T4 513 , typename T5 514 > 515 aux::yes_tag 516 is_bind_helper(bind5< F,T1,T2,T3,T4,T5 >*); 517 518 } // namespace aux 519 520 BOOST_MPL_AUX_ARITY_SPEC(6, bind5) 521 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC(6, bind5) 522 523 namespace aux { 524 525 template<> 526 struct bind_chooser<5> 527 { 528 template< 529 typename F, typename T1, typename T2, typename T3, typename T4 530 , typename T5 531 > 532 struct result_ 533 { 534 typedef bind5< F,T1,T2,T3,T4,T5 > type; 535 }; 536 }; 537 538 } // namespace aux 539 540 namespace aux { 541 542 template< typename T > 543 struct is_bind_arg 544 { 545 BOOST_STATIC_CONSTANT(bool, value = true); 546 }; 547 548 template<> 549 struct is_bind_arg<na> 550 { 551 BOOST_STATIC_CONSTANT(bool, value = false); 552 }; 553 554 template< 555 typename T1, typename T2, typename T3, typename T4, typename T5 556 > 557 struct bind_count_args 558 { 559 BOOST_STATIC_CONSTANT(int, value = 560 is_bind_arg<T1>::value + is_bind_arg<T2>::value 561 + is_bind_arg<T3>::value + is_bind_arg<T4>::value 562 + is_bind_arg<T5>::value 563 ); 564 565 }; 566 567 } 568 569 template< 570 typename F, typename T1, typename T2, typename T3, typename T4 571 , typename T5 572 > 573 struct bind 574 : aux::bind_chooser< 575 aux::bind_count_args< T1,T2,T3,T4,T5 >::value 576 >::template result_< F,T1,T2,T3,T4,T5 >::type 577 { 578 }; 579 580 BOOST_MPL_AUX_ARITY_SPEC( 581 6 582 , bind 583 ) 584 585 BOOST_MPL_AUX_TEMPLATE_ARITY_SPEC( 586 6 587 , bind 588 ) 589 }} 590 591