/usr/include/boost/parameter/preprocessor.hpp is in libboost1.46-dev 1.46.1-7ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 | // Copyright Daniel Wallin 2006. Use, modification and distribution is
// subject to the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_PARAMETER_PREPROCESSOR_060206_HPP
# define BOOST_PARAMETER_PREPROCESSOR_060206_HPP
# include <boost/parameter/parameters.hpp>
# include <boost/parameter/binding.hpp>
# include <boost/parameter/match.hpp>
# include <boost/parameter/aux_/parenthesized_type.hpp>
# include <boost/parameter/aux_/cast.hpp>
# include <boost/parameter/aux_/preprocessor/flatten.hpp>
# include <boost/preprocessor/repetition/repeat_from_to.hpp>
# include <boost/preprocessor/comparison/equal.hpp>
# include <boost/preprocessor/control/if.hpp>
# include <boost/preprocessor/control/iif.hpp>
# include <boost/preprocessor/control/expr_if.hpp>
# include <boost/preprocessor/repetition/enum_params.hpp>
# include <boost/preprocessor/repetition/enum_binary_params.hpp>
# include <boost/preprocessor/repetition/enum_trailing.hpp>
# include <boost/preprocessor/seq/first_n.hpp>
# include <boost/preprocessor/seq/for_each_product.hpp>
# include <boost/preprocessor/seq/for_each_i.hpp>
# include <boost/preprocessor/tuple/elem.hpp>
# include <boost/preprocessor/tuple/eat.hpp>
# include <boost/preprocessor/seq/fold_left.hpp>
# include <boost/preprocessor/seq/push_back.hpp>
# include <boost/preprocessor/seq/size.hpp>
# include <boost/preprocessor/seq/enum.hpp>
# include <boost/preprocessor/seq/push_back.hpp>
# include <boost/preprocessor/detail/is_nullary.hpp>
# include <boost/mpl/always.hpp>
# include <boost/mpl/apply_wrap.hpp>
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# include <boost/type.hpp>
# endif
namespace boost { namespace parameter { namespace aux {
# if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
// Given Match, which is "void x" where x is an argument matching
// criterion, extract a corresponding MPL predicate.
template <class Match>
struct unwrap_predicate;
// Match anything
template <>
struct unwrap_predicate<void*>
{
typedef mpl::always<mpl::true_> type;
};
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x580))
typedef void* voidstar;
// A matching predicate is explicitly specified
template <class Predicate>
struct unwrap_predicate<voidstar (Predicate)>
{
typedef Predicate type;
};
#else
// A matching predicate is explicitly specified
template <class Predicate>
struct unwrap_predicate<void *(Predicate)>
{
typedef Predicate type;
};
#endif
// A type to which the argument is supposed to be convertible is
// specified
template <class Target>
struct unwrap_predicate<void (Target)>
{
typedef is_convertible<mpl::_, Target> type;
};
// Recast the ParameterSpec's nested match metafunction as a free metafunction
template <
class Parameters
, BOOST_PP_ENUM_BINARY_PARAMS(
BOOST_PARAMETER_MAX_ARITY, class A, = boost::parameter::void_ BOOST_PP_INTERCEPT
)
>
struct match
: Parameters::template match<
BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_ARITY, A)
>
{};
# endif
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
// Function template argument deduction does many of the same things
// as type matching during partial specialization, so we call a
// function template to "store" T into the type memory addressed by
// void(*)(T).
template <class T>
msvc_store_type<T,void*(*)(void**(T))>
msvc_store_predicate_type(void*(*)(void**(T)));
template <class T>
msvc_store_type<boost::is_convertible<mpl::_,T>,void*(*)(void*(T))>
msvc_store_predicate_type(void*(*)(void*(T)));
template <class FunctionType>
struct unwrap_predicate
{
static FunctionType f;
// We don't want the function to be evaluated, just instantiated,
// so protect it inside of sizeof.
enum { dummy = sizeof(msvc_store_predicate_type(f)) };
// Now pull the type out of the instantiated base class
typedef typename msvc_type_memory<FunctionType>::storage::type type;
};
template <>
struct unwrap_predicate<void*(*)(void**)>
{
typedef mpl::always<mpl::true_> type;
};
# endif
# undef false_
template <
class Parameters
, BOOST_PP_ENUM_BINARY_PARAMS(
BOOST_PARAMETER_MAX_ARITY, class A, = boost::parameter::void_ BOOST_PP_INTERCEPT
)
>
struct argument_pack
{
typedef typename make_arg_list<
typename BOOST_PARAMETER_build_arg_list(
BOOST_PARAMETER_MAX_ARITY, make_items, typename Parameters::parameter_spec, A
)::type
, typename Parameters::deduced_list
, tag_keyword_arg
, mpl::false_
>::type result;
typedef typename mpl::first<result>::type type;
};
# if 1 //BOOST_WORKAROUND(BOOST_MSVC, < 1300)
// Works around VC6 problem where it won't accept rvalues.
template <class T>
T& as_lvalue(T& value, long)
{
return value;
}
template <class T>
T const& as_lvalue(T const& value, int)
{
return value;
}
# endif
# if BOOST_WORKAROUND(BOOST_MSVC, < 1300) \
|| BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
template <class Predicate, class T, class Args>
struct apply_predicate
{
BOOST_MPL_ASSERT((
mpl::and_<mpl::false_,T>
));
typedef typename mpl::if_<
typename mpl::apply2<Predicate,T,Args>::type
, char
, int
>::type type;
};
template <class P>
struct funptr_predicate
{
static P p;
template <class T, class Args, class P0>
static typename apply_predicate<P0,T,Args>::type
check_predicate(type<T>, Args*, void**(*)(P0));
template <class T, class Args, class P0>
static typename mpl::if_<
is_convertible<T,P0>
, char
, int
>::type check_predicate(type<T>, Args*, void*(*)(P0));
template <class T, class Args>
struct apply
{
BOOST_STATIC_CONSTANT(bool, result =
sizeof(check_predicate(boost::type<T>(), (Args*)0, &p)) == 1
);
typedef mpl::bool_<apply<T,Args>::result> type;
};
};
template <>
struct funptr_predicate<void**>
: mpl::always<mpl::true_>
{};
# endif
}}} // namespace boost::parameter::aux
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
// From Paul Mensonides
# define BOOST_PARAMETER_IS_NULLARY(x) \
BOOST_PP_SPLIT(1, BOOST_PARAMETER_IS_NULLARY_C x BOOST_PP_COMMA() 0) \
/**/
# define BOOST_PARAMETER_IS_NULLARY_C() \
~, 1 BOOST_PP_RPAREN() \
BOOST_PP_TUPLE_EAT(2) BOOST_PP_LPAREN() ~ \
/**/
# else
# define BOOST_PARAMETER_IS_NULLARY(x) BOOST_PP_IS_NULLARY(x)
# endif
# define BOOST_PARAMETER_MEMBER_FUNCTION_CHECK_STATIC_static ()
# define BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
BOOST_PARAMETER_IS_NULLARY( \
BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_CHECK_STATIC_,name) \
)
# if !defined(BOOST_MSVC)
# define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_static
# define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC(name) \
BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_, name)
# else
// Workaround for MSVC preprocessor.
//
// When stripping static from "static f", msvc will produce
// " f". The leading whitespace doesn't go away when pasting
// the token with something else, so this thing is a hack to
// strip the whitespace.
# define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_static (
# define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_AUX(name) \
BOOST_PP_CAT(BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_, name))
# define BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC(name) \
BOOST_PP_SEQ_HEAD( \
BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC_AUX(name) \
)
# endif
# define BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
BOOST_PP_EXPR_IF( \
BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
, static \
)
# define BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name) \
BOOST_PP_IF( \
BOOST_PARAMETER_MEMBER_FUNCTION_IS_STATIC(name) \
, BOOST_PARAMETER_MEMBER_FUNCTION_STRIP_STATIC \
, name BOOST_PP_TUPLE_EAT(1) \
)(name)
// Calculates [begin, end) arity range.
# define BOOST_PARAMETER_ARITY_RANGE_M_optional(state) state
# define BOOST_PARAMETER_ARITY_RANGE_M_deduced_optional(state) state
# define BOOST_PARAMETER_ARITY_RANGE_M_required(state) BOOST_PP_INC(state)
# define BOOST_PARAMETER_ARITY_RANGE_M_deduced_required(state) BOOST_PP_INC(state)
# define BOOST_PARAMETER_ARITY_RANGE_M(s, state, x) \
BOOST_PP_CAT( \
BOOST_PARAMETER_ARITY_RANGE_M_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(x) \
)(state)
/**/
# define BOOST_PARAMETER_ARITY_RANGE(args) \
( \
BOOST_PP_SEQ_FOLD_LEFT(BOOST_PARAMETER_ARITY_RANGE_M, 0, args) \
, BOOST_PP_INC(BOOST_PP_SEQ_SIZE(args)) \
)
/**/
// Accessor macros for the argument specs tuple.
# define BOOST_PARAMETER_FN_ARG_QUALIFIER(x) \
BOOST_PP_TUPLE_ELEM(4,0,x)
/**/
# define BOOST_PARAMETER_FN_ARG_NAME(x) \
BOOST_PP_TUPLE_ELEM(4,1,x)
/**/
# define BOOST_PARAMETER_FN_ARG_PRED(x) \
BOOST_PP_TUPLE_ELEM(4,2,x)
/**/
# define BOOST_PARAMETER_FN_ARG_DEFAULT(x) \
BOOST_PP_TUPLE_ELEM(4,3,x)
/**/
# define BOOST_PARAMETETER_FUNCTION_EAT_KEYWORD_QUALIFIER_out(x)
# define BOOST_PARAMETETER_FUNCTION_EAT_KEYWORD_QUALIFIER_in_out(x)
// Returns 1 if x is either "out(k)" or "in_out(k)".
# define BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER(x) \
BOOST_PP_IS_EMPTY( \
BOOST_PP_CAT(BOOST_PARAMETETER_FUNCTION_EAT_KEYWORD_QUALIFIER_, x) \
) \
/**/
# define BOOST_PARAMETETER_FUNCTION_GET_KEYWORD_QUALIFIER_out(x) x
# define BOOST_PARAMETETER_FUNCTION_GET_KEYWORD_QUALIFIER_in_out(x) x
# define BOOST_PARAMETER_FUNCTION_KEYWORD_GET(x) \
BOOST_PP_CAT(BOOST_PARAMETETER_FUNCTION_GET_KEYWORD_QUALIFIER_, x)
/**/
// Returns the keyword of x, where x is either a keyword qualifier
// or a keyword.
//
// k => k
// out(k) => k
// in_out(k) => k
//
# define BOOST_PARAMETER_FUNCTION_KEYWORD(x) \
BOOST_PP_IF( \
BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER(x) \
, BOOST_PARAMETER_FUNCTION_KEYWORD_GET \
, x BOOST_PP_TUPLE_EAT(1) \
)(x)
/**/
# define BOOST_PARAMETER_FN_ARG_KEYWORD(x) \
BOOST_PARAMETER_FUNCTION_KEYWORD( \
BOOST_PARAMETER_FN_ARG_NAME(x) \
)
// Builds forwarding functions.
# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_TEMPLATE_Z(z, n) \
template<BOOST_PP_ENUM_PARAMS_Z(z, n, class ParameterArgumentType)>
/**/
# if ! defined(BOOST_NO_SFINAE) && ! BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x592))
# define BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z(z, name, parameters, n) \
, typename boost::parameter::aux::match< \
parameters, BOOST_PP_ENUM_PARAMS(n, ParameterArgumentType) \
>::type = parameters()
# else
# define BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z(z, name, parameters, n)
# endif
/**/
# define BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(base) \
BOOST_PP_CAT( \
boost_param_parameters_ \
, BOOST_PP_CAT(__LINE__, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base)) \
)
// Produce a name for a result type metafunction for the function
// named base
# define BOOST_PARAMETER_FUNCTION_RESULT_NAME(base) \
BOOST_PP_CAT( \
boost_param_result_ \
, BOOST_PP_CAT(__LINE__,BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base)) \
)
// Can't do boost_param_impl_ ## basee because base might start with an underscore
// daniel: what? how is that relevant? the reason for using CAT() is to make sure
// base is expanded. i'm not sure we need to here, but it's more stable to do it.
# define BOOST_PARAMETER_IMPL(base) \
BOOST_PP_CAT(boost_param_impl,BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base))
# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION00(z, n, r, data, elem) \
BOOST_PP_IF( \
n \
, BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_TEMPLATE_Z, BOOST_PP_TUPLE_EAT(2) \
)(z,n) \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(7,3,data)) \
inline \
BOOST_PP_EXPR_IF(n, typename) \
BOOST_PARAMETER_FUNCTION_RESULT_NAME(BOOST_PP_TUPLE_ELEM(7,3,data))< \
BOOST_PP_EXPR_IF(n, typename) \
boost::parameter::aux::argument_pack< \
BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(BOOST_PP_TUPLE_ELEM(7,3,data)) \
BOOST_PP_COMMA_IF(n) \
BOOST_PP_IF( \
n, BOOST_PP_SEQ_ENUM, BOOST_PP_TUPLE_EAT(1) \
)(elem) \
>::type \
>::type \
BOOST_PARAMETER_MEMBER_FUNCTION_NAME(BOOST_PP_TUPLE_ELEM(7,3,data))( \
BOOST_PP_IF( \
n \
, BOOST_PP_SEQ_FOR_EACH_I_R \
, BOOST_PP_TUPLE_EAT(4) \
)( \
r \
, BOOST_PARAMETER_FUNCTION_ARGUMENT \
, ~ \
, elem \
) \
BOOST_PP_IF(n, BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z, BOOST_PP_TUPLE_EAT(4))( \
z \
, BOOST_PP_TUPLE_ELEM(7,3,data) \
, BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(BOOST_PP_TUPLE_ELEM(7,3,data)) \
, n \
) \
) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(7,4,data), const) \
{ \
return BOOST_PARAMETER_IMPL(BOOST_PP_TUPLE_ELEM(7,3,data))( \
BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(BOOST_PP_TUPLE_ELEM(7,3,data))()( \
BOOST_PP_ENUM_PARAMS_Z(z, n, a) \
) \
); \
}
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION0(r, data, elem) \
BOOST_PARAMETER_FUNCTION_FWD_FUNCTION00( \
BOOST_PP_TUPLE_ELEM(7,0,data) \
, BOOST_PP_TUPLE_ELEM(7,1,data) \
, r \
, data \
, elem \
)
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_0(z, n, data) \
BOOST_PARAMETER_FUNCTION_FWD_FUNCTION00( \
z, n, BOOST_PP_DEDUCE_R() \
, (z, n, BOOST_PP_TUPLE_REM(5) data) \
, ~ \
)
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_N(z, n, data) \
BOOST_PP_SEQ_FOR_EACH( \
BOOST_PARAMETER_FUNCTION_FWD_FUNCTION0 \
, (z, n, BOOST_PP_TUPLE_REM(5) data) \
, BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
BOOST_PARAMETER_FUNCTION_FWD_PRODUCT \
, BOOST_PP_SEQ_FIRST_N( \
n, BOOST_PP_TUPLE_ELEM(5,3,data) \
) \
) \
)
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTION(z, n, data) \
BOOST_PP_IF( \
n \
, BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_N \
, BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_ARITY_0 \
)(z,n,data) \
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS0( \
result,name,args,const_,combinations,range \
) \
BOOST_PP_REPEAT_FROM_TO( \
BOOST_PP_TUPLE_ELEM(2,0,range), BOOST_PP_TUPLE_ELEM(2,1,range) \
, BOOST_PARAMETER_FUNCTION_FWD_FUNCTION \
, (result,name,const_,combinations,BOOST_PP_TUPLE_ELEM(2,1,range)) \
)
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS(result,name,args, const_, combinations) \
BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS0( \
result, name, args, const_, combinations, BOOST_PARAMETER_ARITY_RANGE(args) \
)
/**/
// Builds boost::parameter::parameters<> specialization
# define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_optional(tag) \
optional<tag
# define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_required(tag) \
required<tag
# define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_deduced_optional(tag) \
optional<boost::parameter::deduced<tag>
# define BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_deduced_required(tag) \
required<boost::parameter::deduced<tag>
# if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# if BOOST_WORKAROUND(BOOST_MSVC, == 1300)
# define BOOST_PARAMETER_PREDICATE_TYPE(p) void*(*) (void* p)
# else
# define BOOST_PARAMETER_PREDICATE_TYPE(p) void p
# endif
# define BOOST_PARAMETER_FUNCTION_PARAMETERS_M(r,tag_namespace,i,elem) \
BOOST_PP_COMMA_IF(i) \
boost::parameter::BOOST_PP_CAT( \
BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
)( \
tag_namespace::BOOST_PARAMETER_FUNCTION_KEYWORD( \
BOOST_PARAMETER_FN_ARG_KEYWORD(elem) \
) \
) \
, typename boost::parameter::aux::unwrap_predicate< \
BOOST_PARAMETER_PREDICATE_TYPE(BOOST_PARAMETER_FN_ARG_PRED(elem)) \
>::type \
>
# elif BOOST_WORKAROUND(BOOST_MSVC, < 1300)
# define BOOST_PARAMETER_FUNCTION_PARAMETERS_M(r,tag_namespace,i,elem) \
BOOST_PP_COMMA_IF(i) \
boost::parameter::BOOST_PP_CAT( \
BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
)( \
tag_namespace::BOOST_PARAMETER_FUNCTION_KEYWORD( \
BOOST_PARAMETER_FN_ARG_KEYWORD(elem) \
) \
) \
, boost::parameter::aux::funptr_predicate< \
void* BOOST_PARAMETER_FN_ARG_PRED(elem) \
> \
>
# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
# define BOOST_PARAMETER_FUNCTION_PARAMETERS_M(r,tag_namespace,i,elem) \
BOOST_PP_COMMA_IF(i) \
boost::parameter::BOOST_PP_CAT( \
BOOST_PARAMETER_FUNCTION_PARAMETERS_QUALIFIER_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(elem) \
)( \
tag_namespace::BOOST_PARAMETER_FUNCTION_KEYWORD( \
BOOST_PARAMETER_FN_ARG_KEYWORD(elem) \
) \
) \
, boost::mpl::always<boost::mpl::true_> \
>
# endif
# define BOOST_PARAMETER_FUNCTION_PARAMETERS(tag_namespace, base, args) \
template <class BoostParameterDummy> \
struct BOOST_PP_CAT( \
BOOST_PP_CAT(boost_param_params_, __LINE__) \
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
) : boost::parameter::parameters< \
BOOST_PP_SEQ_FOR_EACH_I( \
BOOST_PARAMETER_FUNCTION_PARAMETERS_M, tag_namespace, args \
) \
> \
{}; \
\
typedef BOOST_PP_CAT( \
BOOST_PP_CAT(boost_param_params_, __LINE__) \
, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(base) \
)<int>
// Defines result type metafunction
# define BOOST_PARAMETER_FUNCTION_RESULT_ARG(z, _, i, x) \
BOOST_PP_COMMA_IF(i) class BOOST_PP_TUPLE_ELEM(3,1,x)
/**/
# define BOOST_PARAMETER_FUNCTION_RESULT_(result, name, args) \
template <class Args> \
struct BOOST_PARAMETER_FUNCTION_RESULT_NAME(name) \
{ \
typedef typename BOOST_PARAMETER_PARENTHESIZED_TYPE(result) type; \
};
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
# define BOOST_PARAMETER_FUNCTION_RESULT(result, name, args) \
BOOST_PARAMETER_FUNCTION_RESULT_(result, name, args) \
template <> \
struct BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)<int> \
{ typedef int type; };
# else
# define BOOST_PARAMETER_FUNCTION_RESULT(result, name, args) \
BOOST_PARAMETER_FUNCTION_RESULT_(result, name, args)
# endif
// Defines implementation function
# define BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name) \
template <class Args> \
typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)< \
Args \
>::type BOOST_PARAMETER_IMPL(name)(Args const& args)
# define BOOST_PARAMETER_FUNCTION_IMPL_FWD(name) \
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name);
/**/
# define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(state, arg) \
( \
BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 0, state)) \
, BOOST_PP_SEQ_PUSH_BACK(BOOST_PP_TUPLE_ELEM(4, 1, state), arg) \
, BOOST_PP_TUPLE_ELEM(4, 2, state) \
, BOOST_PP_TUPLE_ELEM(4, 3, state) \
)
# define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_required(state, arg) \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG_required(state, arg)
# define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(state, arg) \
( \
BOOST_PP_TUPLE_ELEM(4, 0, state) \
, BOOST_PP_TUPLE_ELEM(4, 1, state) \
, BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 2, state)) \
, BOOST_PP_SEQ_PUSH_BACK(BOOST_PP_TUPLE_ELEM(4, 3, state), arg) \
)
# define BOOST_PARAMETER_FUNCTION_SPLIT_ARG_deduced_optional(state, arg) \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG_optional(state, arg)
# define BOOST_PARAMETER_FUNCTION_SPLIT_ARG(s, state, arg) \
BOOST_PP_CAT( \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG_ \
, BOOST_PARAMETER_FN_ARG_QUALIFIER(arg) \
)(state, arg)
// Returns (required_count, required, optional_count, optionals) tuple
# define BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args) \
BOOST_PP_SEQ_FOLD_LEFT( \
BOOST_PARAMETER_FUNCTION_SPLIT_ARG \
, (0,BOOST_PP_SEQ_NIL, 0,BOOST_PP_SEQ_NIL) \
, args \
)
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG_NAME(keyword) \
BOOST_PP_CAT(BOOST_PP_CAT(keyword,_),type)
// Helpers used as parameters to BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS.
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG(r, _, arg) \
, class BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG_NAME( \
BOOST_PARAMETER_FN_ARG_KEYWORD(arg) \
)
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG(r, _, arg) \
, BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG_NAME( \
BOOST_PARAMETER_FN_ARG_KEYWORD(arg) \
)& BOOST_PARAMETER_FN_ARG_KEYWORD(arg)
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_PARAMETER(r, _, arg) \
, BOOST_PARAMETER_FN_ARG_KEYWORD(arg)
// Produces a name for the dispatch functions.
# define BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name) \
BOOST_PP_CAT( \
boost_param_default_ \
, BOOST_PP_CAT(__LINE__, BOOST_PARAMETER_MEMBER_FUNCTION_NAME(name)) \
)
// Helper macro used below to produce lists based on the keyword argument
// names. macro is applied to every element. n is the number of
// optional arguments that should be included.
# define BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS(macro, n, split_args) \
BOOST_PP_SEQ_FOR_EACH( \
macro \
, ~ \
, BOOST_PP_TUPLE_ELEM(4,1,split_args) \
) \
BOOST_PP_SEQ_FOR_EACH( \
macro \
, ~ \
, BOOST_PP_SEQ_FIRST_N( \
BOOST_PP_SUB(BOOST_PP_TUPLE_ELEM(4,2,split_args), n) \
, BOOST_PP_TUPLE_ELEM(4,3,split_args) \
) \
)
// Generates a keyword | default expression.
# define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT(arg, tag_namespace) \
boost::parameter::keyword< \
tag_namespace::BOOST_PARAMETER_FN_ARG_KEYWORD(arg) \
>::instance | boost::parameter::aux::use_default_tag()
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_GET_ARG(arg, tag_ns) \
BOOST_PARAMETER_FUNCTION_CAST( \
args[ \
BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT( \
arg, tag_ns \
) \
] \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
)
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY(name, n, split_args, tag_namespace) \
{ \
return BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
(ResultType(*)())0 \
, args \
, 0L \
BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_PARAMETER \
, n \
, split_args \
) \
, BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_GET_ARG( \
BOOST_PP_SEQ_ELEM( \
BOOST_PP_SUB(BOOST_PP_TUPLE_ELEM(4,2,split_args), n) \
, BOOST_PP_TUPLE_ELEM(4,3,split_args) \
) \
, tag_namespace \
) \
); \
}
# define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_ACTUAL_DEFAULT(arg) \
BOOST_PARAMETER_FUNCTION_CAST( \
boost::parameter::aux::as_lvalue(BOOST_PARAMETER_FN_ARG_DEFAULT(arg), 0L) \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
)
# define BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT_BODY(name, n, split_args, tag_ns, const_) \
template < \
class ResultType \
, class Args \
BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG \
, BOOST_PP_INC(n) \
, split_args \
) \
> \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
ResultType BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
ResultType(*)() \
, Args const& args \
, long \
BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG \
, BOOST_PP_INC(n) \
, split_args \
) \
, boost::parameter::aux::use_default_tag \
) BOOST_PP_EXPR_IF(const_, const) \
{ \
return BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
(ResultType(*)())0 \
, args \
, 0L \
BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_PARAMETER \
, BOOST_PP_INC(n) \
, split_args \
) \
, BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_ACTUAL_DEFAULT( \
BOOST_PP_SEQ_ELEM( \
BOOST_PP_SUB(BOOST_PP_TUPLE_ELEM(4,2,split_args), BOOST_PP_INC(n)) \
, BOOST_PP_TUPLE_ELEM(4,3,split_args) \
) \
) \
); \
}
// Produces a forwarding layer in the default evaluation machine.
//
// data is a tuple:
//
// (name, split_args)
//
// Where name is the base name of the function, and split_args is a tuple:
//
// (required_count, required_args, optional_count, required_args)
//
// defines the actual function body for BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION below.
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION0(z, n, data) \
template < \
class ResultType \
, class Args \
BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG \
, n \
, BOOST_PP_TUPLE_ELEM(5,1,data) \
) \
> \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(BOOST_PP_TUPLE_ELEM(5,0,data)) \
ResultType BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(BOOST_PP_TUPLE_ELEM(5,0,data))( \
ResultType(*)() \
, Args const& args \
, int \
BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG \
, n \
, BOOST_PP_TUPLE_ELEM(5,1,data) \
) \
) BOOST_PP_EXPR_IF(BOOST_PP_TUPLE_ELEM(5,2,data), const) \
BOOST_PP_IF( \
n \
, BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_BODY \
, ; BOOST_PP_TUPLE_EAT(4) \
)( \
BOOST_PP_TUPLE_ELEM(5,0,data) \
, n \
, BOOST_PP_TUPLE_ELEM(5,1,data) \
, BOOST_PP_TUPLE_ELEM(5,3,data) \
)
# define BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION(z, n, data) \
BOOST_PP_IF( \
BOOST_PP_AND( \
BOOST_PP_NOT(n) \
, BOOST_PP_TUPLE_ELEM(5,4,data) \
) \
, BOOST_PP_TUPLE_EAT(3) \
, BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION0 \
)(z, n, data) \
BOOST_PP_IF( \
BOOST_PP_EQUAL(n, BOOST_PP_TUPLE_ELEM(4,2,BOOST_PP_TUPLE_ELEM(5,1,data))) \
, BOOST_PP_TUPLE_EAT(5) \
, BOOST_PARAMETER_FUNCTION_DEFAULT_EVAL_DEFAULT_BODY \
)( \
BOOST_PP_TUPLE_ELEM(5,0,data) \
, n \
, BOOST_PP_TUPLE_ELEM(5,1,data) \
, BOOST_PP_TUPLE_ELEM(5,3,data) \
, BOOST_PP_TUPLE_ELEM(5,2,data) \
)
# define BOOST_PARAMETER_FUNCTION_DEFAULT_GET_ARG(r, tag_ns, arg) \
, BOOST_PARAMETER_FUNCTION_CAST( \
args[ \
boost::parameter::keyword<tag_ns::BOOST_PARAMETER_FN_ARG_KEYWORD(arg)>::instance \
] \
, BOOST_PARAMETER_FN_ARG_PRED(arg) \
)
// Generates the function template that recives a ArgumentPack, and then
// goes on to call the layers of overloads generated by
// BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER.
# define BOOST_PARAMETER_FUNCTION_INITIAL_DISPATCH_FUNCTION(name, split_args, const_, tag_ns) \
template <class Args> \
typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)<Args>::type \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
BOOST_PARAMETER_IMPL(name)(Args const& args) BOOST_PP_EXPR_IF(const_, const) \
{ \
return BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
(typename BOOST_PARAMETER_FUNCTION_RESULT_NAME(name)<Args>::type(*)())0 \
, args \
, 0L \
\
BOOST_PP_SEQ_FOR_EACH( \
BOOST_PARAMETER_FUNCTION_DEFAULT_GET_ARG \
, tag_ns \
, BOOST_PP_TUPLE_ELEM(4,1,split_args) \
) \
\
); \
}
// Helper for BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER below.
# define BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER_AUX( \
name, split_args, skip_fwd_decl, const_, tag_namespace \
) \
BOOST_PP_REPEAT_FROM_TO( \
0 \
, BOOST_PP_INC(BOOST_PP_TUPLE_ELEM(4, 2, split_args)) \
, BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION \
, (name, split_args, const_, tag_namespace, skip_fwd_decl) \
) \
\
BOOST_PARAMETER_FUNCTION_INITIAL_DISPATCH_FUNCTION(name, split_args, const_, tag_namespace) \
\
template < \
class ResultType \
, class Args \
BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_TEMPLATE_ARG \
, 0 \
, split_args \
) \
> \
BOOST_PARAMETER_MEMBER_FUNCTION_STATIC(name) \
ResultType BOOST_PARAMETER_FUNCTION_DEFAULT_NAME(name)( \
ResultType(*)() \
, Args const& args \
, int \
BOOST_PARAMETER_FUNCTION_DEFAULT_ARGUMENTS( \
BOOST_PARAMETER_FUNCTION_DEFAULT_FUNCTION_ARG \
, 0 \
, split_args \
) \
) BOOST_PP_EXPR_IF(const_, const)
// Generates a bunch of forwarding functions that each extract
// one more argument.
# define BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER(name, args, skip_fwd_decl, const_, tag_ns) \
BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER_AUX( \
name, BOOST_PARAMETER_FUNCTION_SPLIT_ARGS(args), skip_fwd_decl, const_, tag_ns \
)
/**/
// Defines the result metafunction and the parameters specialization.
# define BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
BOOST_PARAMETER_FUNCTION_RESULT(result, name, args) \
\
BOOST_PARAMETER_FUNCTION_PARAMETERS(tag_namespace, name, args) \
BOOST_PARAMETER_FUNCTION_PARAMETERS_NAME(name); \
// Helper for BOOST_PARAMETER_FUNCTION below.
# define BOOST_PARAMETER_FUNCTION_AUX(result, name, tag_namespace, args) \
BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name); \
\
BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
result, name, args, 0 \
, BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
) \
\
BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER(name, args, 0, 0, tag_namespace)
// Defines a Boost.Parameter enabled function with the new syntax.
# define BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, args) \
BOOST_PARAMETER_FUNCTION_AUX( \
result, name, tag_namespace \
, BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
) \
/**/
// Defines a Boost.Parameter enabled function.
# define BOOST_PARAMETER_BASIC_FUNCTION_AUX(result, name, tag_namespace, args) \
BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
\
BOOST_PARAMETER_FUNCTION_IMPL_FWD(name) \
\
BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
result, name, args, 0 \
, BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
) \
\
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name)
# define BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, args) \
BOOST_PARAMETER_BASIC_FUNCTION_AUX( \
result, name, tag_namespace \
, BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
) \
/**/
// Defines a Boost.Parameter enabled member function.
# define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX(result, name, tag_namespace, args, const_) \
BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
\
BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
result, name, args, const_ \
, BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
) \
\
BOOST_PARAMETER_FUNCTION_IMPL_HEAD(name) BOOST_PP_EXPR_IF(const_, const) \
/**/
# define BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_namespace, args) \
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
result, name, tag_namespace \
, BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
, 0 \
)
/**/
# define BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(result, name, tag_namespace, args) \
BOOST_PARAMETER_BASIC_MEMBER_FUNCTION_AUX( \
result, name, tag_namespace \
, BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
, 1 \
)
/**/
# define BOOST_PARAMETER_MEMBER_FUNCTION_AUX(result, name, tag_namespace, const_, args) \
BOOST_PARAMETER_FUNCTION_HEAD(result, name, tag_namespace, args) \
\
BOOST_PARAMETER_FUNCTION_FWD_FUNCTIONS( \
result, name, args, const_ \
, BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
) \
\
BOOST_PARAMETER_FUNCTION_DEFAULT_LAYER(name, args, 1, const_, tag_namespace)
// Defines a Boost.Parameter enabled function with the new syntax.
# define BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_namespace, args) \
BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
result, name, tag_namespace, 0 \
, BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
) \
/**/
# define BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_namespace, args) \
BOOST_PARAMETER_MEMBER_FUNCTION_AUX( \
result, name, tag_namespace, 1 \
, BOOST_PARAMETER_FLATTEN(3, 2, 3, args) \
) \
/**/
// Defines a Boost.Parameter enabled constructor.
# define BOOST_PARAMETER_FUNCTION_ARGUMENT(r, _, i, elem) \
BOOST_PP_COMMA_IF(i) elem& BOOST_PP_CAT(a, i)
/**/
# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
// Older MSVC can't do what's necessary to handle commas in base names; just
// use a typedef instead if you have a base name that contains commas.
# define BOOST_PARAMETER_PARENTHESIZED_BASE(x) BOOST_PP_SEQ_HEAD(x)
# else
# define BOOST_PARAMETER_PARENTHESIZED_BASE(x) BOOST_PARAMETER_PARENTHESIZED_TYPE(x)
# endif
# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR00(z, n, r, data, elem) \
BOOST_PP_IF( \
n \
, BOOST_PARAMETER_FUNCTION_FWD_FUNCTION_TEMPLATE_Z, BOOST_PP_TUPLE_EAT(2) \
)(z, n) \
BOOST_PP_EXPR_IF(BOOST_PP_EQUAL(n,1), explicit) \
BOOST_PP_TUPLE_ELEM(6,2,data)( \
BOOST_PP_IF( \
n \
, BOOST_PP_SEQ_FOR_EACH_I_R \
, BOOST_PP_TUPLE_EAT(4) \
)( \
r \
, BOOST_PARAMETER_FUNCTION_ARGUMENT \
, ~ \
, elem \
) \
BOOST_PP_IF(n, BOOST_PARAMETER_FUNCTION_FWD_MATCH_Z, BOOST_PP_TUPLE_EAT(4))( \
z \
, BOOST_PP_TUPLE_ELEM(6,3,data) \
, BOOST_PP_CAT(constructor_parameters, __LINE__) \
, n \
) \
) \
: BOOST_PARAMETER_PARENTHESIZED_BASE(BOOST_PP_TUPLE_ELEM(6,3,data)) ( \
BOOST_PP_CAT(constructor_parameters, __LINE__)()( \
BOOST_PP_ENUM_PARAMS_Z(z, n, a) \
) \
) \
{}
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR0(r, data, elem) \
BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR00( \
BOOST_PP_TUPLE_ELEM(6,0,data) \
, BOOST_PP_TUPLE_ELEM(6,1,data) \
, r \
, data \
, elem \
)
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_PRODUCT(r, product) \
(product)
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_0(z, n, data) \
BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR00( \
z, n, BOOST_PP_DEDUCE_R() \
, (z, n, BOOST_PP_TUPLE_REM(4) data) \
, ~ \
)
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_N(z, n, data) \
BOOST_PP_SEQ_FOR_EACH( \
BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR0 \
, (z, n, BOOST_PP_TUPLE_REM(4) data) \
, BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
BOOST_PARAMETER_FUNCTION_FWD_PRODUCT \
, BOOST_PP_SEQ_FIRST_N( \
n, BOOST_PP_TUPLE_ELEM(4,2,data) \
) \
) \
)
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR(z, n, data) \
BOOST_PP_IF( \
n \
, BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_N \
, BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR_ARITY_0 \
)(z,n,data) \
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS0(class_,base,args,combinations,range) \
BOOST_PP_REPEAT_FROM_TO( \
BOOST_PP_TUPLE_ELEM(2,0,range), BOOST_PP_TUPLE_ELEM(2,1,range) \
, BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTOR \
, (class_,base,combinations,BOOST_PP_TUPLE_ELEM(2,1,range)) \
)
/**/
# define BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS(class_,base,args,combinations) \
BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS0( \
class_, base, args, combinations, BOOST_PARAMETER_ARITY_RANGE(args) \
)
/**/
# define BOOST_PARAMETER_CONSTRUCTOR_AUX(class_, base, tag_namespace, args) \
BOOST_PARAMETER_FUNCTION_PARAMETERS(tag_namespace, ctor, args) \
BOOST_PP_CAT(constructor_parameters, __LINE__); \
\
BOOST_PARAMETER_FUNCTION_FWD_CONSTRUCTORS( \
class_, base, args \
, BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
) \
/**/
# define BOOST_PARAMETER_CONSTRUCTOR(class_, base, tag_namespace, args) \
BOOST_PARAMETER_CONSTRUCTOR_AUX( \
class_, base, tag_namespace \
, BOOST_PARAMETER_FLATTEN(2, 2, 3, args) \
)
/**/
# ifndef BOOST_NO_FUNCTION_TEMPLATE_ORDERING
# define BOOST_PARAMETER_FUNCTION_FWD_COMBINATION(r, _, i, elem) \
(BOOST_PP_IF( \
BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER( \
BOOST_PARAMETER_FN_ARG_NAME(elem) \
) \
, (const ParameterArgumentType ## i)(ParameterArgumentType ## i) \
, (const ParameterArgumentType ## i) \
))
// MSVC6.5 lets us bind rvalues to T&.
# elif BOOST_WORKAROUND(BOOST_MSVC, < 1300)
# define BOOST_PARAMETER_FUNCTION_FWD_COMBINATION(r, _, i, elem) \
(BOOST_PP_IF( \
BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER( \
BOOST_PARAMETER_FN_ARG_NAME(elem) \
) \
, (ParameterArgumentType ## i) \
, (const ParameterArgumentType ## i) \
))
// No partial ordering. This feature doesn't work.
// This is exactly the same as for VC6.5, but we might change it later.
# else
# define BOOST_PARAMETER_FUNCTION_FWD_COMBINATION(r, _, i, elem) \
(BOOST_PP_IF( \
BOOST_PARAMETER_FUNCTION_IS_KEYWORD_QUALIFIER( \
BOOST_PARAMETER_FN_ARG_NAME(elem) \
) \
, (ParameterArgumentType ## i) \
, (const ParameterArgumentType ## i) \
))
# endif
# define BOOST_PARAMETER_FUNCTION_FWD_COMBINATIONS(args) \
BOOST_PP_SEQ_FOR_EACH_I(BOOST_PARAMETER_FUNCTION_FWD_COMBINATION, ~, args)
#endif // BOOST_PARAMETER_PREPROCESSOR_060206_HPP
|