1++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2The Boost Parameter Library Reference Documentation 3++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 5:Authors: David Abrahams, Daniel Wallin 6:Contact: dave@boost-consulting.com, daniel@boostpro.com 7:organization: `BoostPro Computing`_ 8:date: $Date: 2005/07/17 19:53:01 $ 9 10:copyright: Copyright David Abrahams, Daniel Wallin 11 2005-2009. Distributed under the Boost Software License, 12 Version 1.0. (See accompanying file LICENSE_1_0.txt 13 or copy at http://www.boost.org/LICENSE_1_0.txt) 14 15|(logo)|__ 16 17.. |(logo)| image:: ../../../../boost.png 18 :alt: Boost 19 20__ ../../../../index.htm 21 22.. _`BoostPro Computing`: http://www.boostpro.com 23 24 25////////////////////////////////////////////////////////////////////////////// 26 27.. contents:: 28 :depth: 2 29 30////////////////////////////////////////////////////////////////////////////// 31 32.. role:: class 33 :class: class 34 35.. role:: concept 36 :class: concept 37 38.. role:: function 39 :class: function 40 41.. |ArgumentPack| replace:: :concept:`ArgumentPack` 42.. |ForwardSequence| replace:: :concept:`Forward Sequence` 43.. |ParameterSpec| replace:: :concept:`ParameterSpec` 44 45.. role:: vellipsis 46 :class: vellipsis 47 48.. section-numbering:: 49 :depth: 2 50 51Preliminaries 52============= 53 54This section covers some basic information you'll need to know in order to 55understand this reference. 56 57Namespaces 58---------- 59 60In this document, all unqualified identifiers should be assumed to be defined 61in namespace ``boost::parameter`` unless otherwise specified. 62 63Exceptions 64---------- 65 66No operation described in this document throws an exception unless otherwise 67specified. 68 69Thread Safety 70------------- 71 72All components of this library can be used safely from multiple threads 73without synchronization. [#thread]_ 74 75Typography 76---------- 77 78Names written in :concept:`sans serif type` represent concepts_. 79 80In code blocks, *italic type* represents unspecified text that satisfies the 81requirements given in the detailed description that follows the code block. 82 83In a specification of the tokens generated by a macro, **bold type** is used 84to highlight the position of the expanded macro argument in the result. 85 86The special character β represents the value of |BOOST_PARAMETER_MAX_ARITY|_. 87 88////////////////////////////////////////////////////////////////////////////// 89 90Terminology 91=========== 92 93.. |kw| replace:: keyword 94.. _kw: 95 96keyword 97 The name of a function parameter. 98 99.. _keyword tag type: 100.. |keyword tag type| replace:: `keyword tag type`_ 101 102keyword tag type 103 A type used to uniquely identify a function parameter. Typically its name 104 will be the same as that of the parameter. 105 106.. _positional: 107.. |positional| replace:: `positional`_ 108 109positional argument 110 An argument passed with no explicit |kw|. Its parameter is determined 111 in the usual C++ way: by position with respect to a parameter list. 112 113.. _tag type: 114.. |tag type| replace:: `tag type`_ 115 116tag type 117 Shorthand for “\ |keyword tag type|.” 118 119.. _keyword object: 120.. |keyword object| replace:: `keyword object`_ 121 122keyword object 123 An instance of |keyword|_\ ``<T>`` for some |tag type| ``T``. 124 125.. _tagged reference: 126.. |tagged reference| replace:: `tagged reference`_ 127 128tagged reference 129 An object whose type is associated with a |keyword tag type| (the object's 130 *keyword*), and that holds a reference (to the object's *value*). 131 132 As a shorthand, a “tagged reference to ``x``\ ” means a tagged reference 133 whose *value* is ``x``. 134 135.. _tagged default: 136.. |tagged default| replace:: `tagged default`_ 137 138tagged default 139 A |tagged reference| whose *value* represents the value of a 140 default argument. 141 142.. _tagged lazy default: 143.. |tagged lazy default| replace:: `tagged lazy default`_ 144 145tagged lazy default 146 A |tagged reference| whose *value*, when invoked with no arguments, 147 computes a default argument value. 148 149.. _intended argument type: 150.. |intended argument type| replace:: `intended argument type`_ 151 152intended argument type 153 The *intended argument type* of a single-element |ArgumentPack|_ is the 154 type of its element's *value*. The intended argument type of any other 155 type ``X`` is ``X`` itself. 156 157.. Note:: 158 159 In this reference, we will use concept names (and other names) to describe 160 both types and objects, depending on context. So for example, “an 161 |ArgumentPack|_\ ” can refer to a type that models |ArgumentPack|_ 162 *or* an object of such a type. 163 164////////////////////////////////////////////////////////////////////////////// 165 166Concepts 167======== 168 169This section describes the generic type concepts used by the Parameter 170library. 171 172|ArgumentPack| 173-------------- 174 175An |ArgumentPack| is a collection of |tagged reference|\ s to the actual 176arguments passed to a function. Every |ArgumentPack| is also a valid `MPL 177Forward Sequence`_ and `MPL Associative Sequence`_ consisting of the |keyword 178tag type|\ s in its |tagged reference|\ s. If |BOOST_PARAMETER_CAN_USE_MP11| 179is defined, then every |ArgumentPack| is also a valid |Boost_MP11|_ map whose 180keys are |keyword tag type|\ s. The |singular_cpp|_, |compose_cpp|_, and 181|mpl_cpp|_ test programs demonstrate this functionality. 182 183Requirements 184............ 185 186In the table below, 187 188* ``A`` is a model of |ArgumentPack| 189* ``x`` is an instance of ``A`` 190* ``u`` is a |keyword object| of type ``K`` 191* ``v`` is a |tagged default| with |tag type| ``L`` and *value* of type ``D`` 192* ``w`` is a |tagged lazy default| with |tag type| ``M`` and *value* of type ``E const`` 193* ``z`` is an |ArgumentPack| containing a single element (as created by |keyword|_\ ``<…>::operator=``) 194 195Any exceptions thrown from the invocation of ``w``\ 's *value* 196will be propagated to the caller. 197 198.. table:: |ArgumentPack| requirements 199 200 +------------+---------------------------------+----------------+----------------------+ 201 | Expression | Type | Requirements | Semantics/Notes | 202 +============+=================================+================+======================+ 203 | ``x[u]`` | ``binding<A, K>::type`` | ``x`` contains | Returns *b*\ 's | 204 | | | an element *b* | *value* (by | 205 | | | whose |kw|_ is | reference). | 206 | | | ``K`` | | 207 +------------+---------------------------------+----------------+----------------------+ 208 | ``x[u]`` | ``binding<A, L, D>::type`` | *none* | If ``x`` contains an | 209 | | | | element *b* whose | 210 | | | | |kw|_ is the same as | 211 | | | | ``u``\ 's, returns | 212 | | | | *b*\ 's *value* (by | 213 | | | | reference). | 214 | | | | Otherwise, returns | 215 | | | | ``u``\ 's *value*. | 216 +------------+---------------------------------+----------------+----------------------+ 217 | ``x[w]`` | ``lazy_binding<A, M, E>::type`` | *none* | If ``x`` contains an | 218 | | | | element *b* whose | 219 | | | | |kw|_ is the same as | 220 | | | | ``w``\ 's, returns | 221 | | | | *b*\ 's *value* (by | 222 | | | | reference). | 223 | | | | Otherwise, invokes | 224 | | | | ``w``\ 's *value* | 225 | | | | and returns the | 226 | | | | result. | 227 +------------+---------------------------------+----------------+----------------------+ 228 | ``x, z`` | Model of |ArgumentPack|_ | *none* | Returns an | 229 | | | | |ArgumentPack|_ | 230 | | | | containing all the | 231 | | | | elements of both | 232 | | | | ``x`` and ``z``. | 233 +------------+---------------------------------+----------------+----------------------+ 234 235.. _parameterspec: 236 237|ParameterSpec| 238--------------- 239 240A |ParameterSpec| describes the type requirements for arguments corresponding 241to a given |kw|_ and indicates whether the argument is optional or 242required. The table below details the allowed forms and describes their 243condition for satisfaction by an actual argument type. In each row, 244 245.. _conditions: 246 247* ``K`` is the |ParameterSpec|\ 's |keyword tag type| 248* ``A`` is an |intended argument type| associated with ``K``, if any 249* ``P`` is a model of |ArgumentPack| that contains ``A`` 250* ``F`` is an `MPL Binary Metafunction Class`_ 251 252.. _`MPL Binary Metafunction Class`: ../../../mpl/doc/refmanual/metafunction-class.html 253 254.. table:: |ParameterSpec| allowed forms and conditions of satisfaction 255 256 +------------------------+----------+----------------------------------------+ 257 | Type | ``A`` | Condition ``A`` must satisfy | 258 | | required | | 259 +========================+==========+========================================+ 260 | ``K`` | no | *n/a* | 261 +------------------------+----------+----------------------------------------+ 262 | |optional|_\ ``<K,F>`` | no | ``mpl::apply2<F,A,P>::type::value`` is | 263 | | | ``true``. | 264 +------------------------+----------+----------------------------------------+ 265 | |required|_\ ``<K,F>`` | yes | ``mpl::apply2<F,A,P>::type::value`` is | 266 | | | ``true``. | 267 +------------------------+----------+----------------------------------------+ 268 269The information in a |ParameterSpec| is used to `limit`__ the arguments that 270will be matched by `forwarding functions`_. 271 272__ overloadcontrol_ 273.. _overloadcontrol: index.html#controlling-overload-resolution 274.. _forwarding functions: index.html#forwarding-functions 275 276////////////////////////////////////////////////////////////////////////////// 277 278Class Templates 279=============== 280 281.. |keyword| replace:: ``keyword`` 282.. _keyword: 283 284``keyword`` 285----------- 286 287The type of every |keyword object| is a specialization of |keyword|. 288 289:Defined in: |keyword_header|_ 290 291.. parsed-literal:: 292 293 template <typename Tag> 294 struct keyword 295 { 296 typedef Tag tag; 297 298 template <typename T> 299 constexpr typename |boost_enable_if|_\< 300 typename |mpl_eval_if|_\< 301 |boost_is_scalar|_\<T> 302 , |mpl_true|_\ // Enable this overload for scalar types. 303 , |mpl_eval_if|_\< 304 |boost_is_same|_\< 305 typename Tag\:\:qualifier 306 , boost::parameter::in_reference 307 > 308 , |mpl_true|_\ // Enable this overload for "in" references. 309 , |mpl_if|_\< 310 |boost_is_same|_\< 311 typename Tag\:\:qualifier 312 , boost::parameter::forward_reference 313 > 314 , |mpl_true|_\ // Enable this overload for "forward" references. 315 , |mpl_false|_\ // Disable this overload for all other reference categories. 316 > 317 > 318 >::type 319 , |ArgumentPack|_ 320 >::type 321 |assignment operator|_\(T const& value) const; 322 323 template <typename T> 324 constexpr typename |boost_enable_if|_\< 325 typename |mpl_eval_if|_\< 326 typename |mpl_eval_if|_\< 327 |boost_is_same|_\< 328 typename Tag\:\:qualifier 329 , boost::parameter::out_reference 330 > 331 , |mpl_true|_\ // The reference category is "out". 332 , |mpl_if|_\< 333 |boost_is_same|_\< 334 typename Tag\:\:qualifier 335 , boost::parameter::forward_reference 336 > 337 , |mpl_true|_\ // The reference category is "forward". 338 , |mpl_false|_\ // The reference category is neither "out" nor "forward". 339 > 340 >::type 341 , |mpl_if|_\< 342 |boost_is_const|_\<T> 343 , |mpl_false|_\ // Disable this overload for reference-to-const types. 344 , |mpl_true|_\ // Enable this overload for referece-to-mutable types. 345 > 346 , |mpl_false|_\ // Disable this overload for references neither "out" nor "forward". 347 >::type 348 , |ArgumentPack|_ 349 >::type 350 |assignment operator|_\(T& value) const; 351 352 template <typename T> 353 constexpr typename |boost_enable_if|_\< 354 typename |mpl_eval_if|_\< 355 |boost_is_scalar|_\<T> 356 , |mpl_false|_\ // Disable this overload for scalar types. 357 , |mpl_eval_if|_\< 358 |boost_is_same|_\< 359 typename Tag\:\:qualifier 360 , boost::parameter::in_reference 361 > 362 , |mpl_true|_\ // Enable this overload for "in" references. 363 , |mpl_if|_\< 364 |boost_is_same|_\< 365 typename Tag\:\:qualifier 366 , boost::parameter::forward_reference 367 > 368 , |mpl_true|_\ // Enable this overload for "forward" references. 369 , |mpl_false|_\ // Disable this overload for all other reference categories. 370 > 371 > 372 >::type 373 , |ArgumentPack|_ 374 >::type 375 |assignment operator|_\(T const&& value) const; 376 377 template <typename T> 378 constexpr typename |boost_enable_if|_\< 379 typename |mpl_eval_if|_\< 380 |boost_is_scalar|_\<T> 381 , |mpl_false|_\ // Disable this overload for scalar types. 382 , |mpl_eval_if|_\< 383 |boost_is_same|_\< 384 typename Tag\:\:qualifier 385 , boost::parameter::consume_reference 386 > 387 , |mpl_true|_\ // Enable this overload for "consume" references. 388 , |mpl_if|_\< 389 |boost_is_same|_\< 390 typename Tag\:\:qualifier 391 , boost::parameter::forward_reference 392 > 393 , |mpl_true|_\ // Enable this overload for "forward" references. 394 , |mpl_false|_\ // Disable this overload for all other reference categories. 395 > 396 > 397 >::type 398 , |ArgumentPack|_ 399 >::type 400 |assignment operator|_\(T&& value) const; 401 402 template <typename T> 403 constexpr typename |boost_enable_if|_\< 404 typename |mpl_eval_if|_\< 405 |boost_is_scalar|_\<T> 406 , |mpl_true|_\ // Enable this overload for scalar types. 407 , |mpl_eval_if|_\< 408 |boost_is_same|_\< 409 typename Tag\:\:qualifier 410 , boost::parameter::in_reference 411 > 412 , |mpl_true|_\ // Enable this overload for "in" references. 413 , |mpl_if|_\< 414 |boost_is_same|_\< 415 typename Tag\:\:qualifier 416 , boost::parameter::forward_reference 417 > 418 , |mpl_true|_\ // Enable this overload for "forward" references. 419 , |mpl_false|_\ // Disable this overload for all other reference categories. 420 > 421 > 422 >::type 423 , *tagged default* 424 >::type 425 |bitwise or operator|_\(T const& x) const; 426 427 template <typename T> 428 constexpr typename |boost_enable_if|_\< 429 typename |mpl_eval_if|_\< 430 typename |mpl_eval_if|_\< 431 |boost_is_same|_\< 432 typename Tag\:\:qualifier 433 , boost::parameter::out_reference 434 > 435 , |mpl_true|_\ // The reference category is "out". 436 , |mpl_if|_\< 437 |boost_is_same|_\< 438 typename Tag\:\:qualifier 439 , boost::parameter::forward_reference 440 > 441 , |mpl_true|_\ // The reference category is "forward". 442 , |mpl_false|_\ // The reference category is neither "out" nor "forward". 443 > 444 >::type 445 , |mpl_if|_\< 446 |boost_is_const|_\<T> 447 , |mpl_false|_\ // Disable this overload for reference-to-const types. 448 , |mpl_true|_\ // Enable this overload for referece-to-mutable types. 449 > 450 , |mpl_false|_\ // Disable this overload for references neither "out" nor "forward". 451 >::type 452 , *tagged default* 453 >::type 454 |bitwise or operator|_\(T& x) const; 455 456 template <typename T> 457 constexpr typename |boost_enable_if|_\< 458 typename |mpl_eval_if|_\< 459 |boost_is_scalar|_\<T> 460 , |mpl_false|_\ // Disable this overload for scalar types. 461 , |mpl_eval_if|_\< 462 |boost_is_same|_\< 463 typename Tag\:\:qualifier 464 , boost::parameter::in_reference 465 > 466 , |mpl_true|_\ // Enable this overload for "in" references. 467 , |mpl_if|_\< 468 |boost_is_same|_\< 469 typename Tag\:\:qualifier 470 , boost::parameter::forward_reference 471 > 472 , |mpl_true|_\ // Enable this overload for "forward" references. 473 , |mpl_false|_\ // Disable this overload for all other reference categories. 474 > 475 > 476 >::type 477 , *tagged default* 478 >::type 479 |bitwise or operator|_\(T const&& x) const; 480 481 template <typename T> 482 constexpr typename |boost_enable_if|_\< 483 typename |mpl_eval_if|_\< 484 |boost_is_scalar|_\<T> 485 , |mpl_false|_\ // Disable this overload for scalar types. 486 , |mpl_eval_if|_\< 487 |boost_is_same|_\< 488 typename Tag\:\:qualifier 489 , boost::parameter::consume_reference 490 > 491 , |mpl_true|_\ // Enable this overload for "consume" references. 492 , |mpl_if|_\< 493 |boost_is_same|_\< 494 typename Tag\:\:qualifier 495 , boost::parameter::forward_reference 496 > 497 , |mpl_true|_\ // Enable this overload for "forward" references. 498 , |mpl_false|_\ // Disable this overload for all other reference categories. 499 > 500 > 501 >::type 502 , *tagged default* 503 >::type constexpr 504 |bitwise or operator|_\(T&& value) const; 505 506 template <typename F> 507 constexpr *tagged lazy default* |logical or operator|_\(F const&) const; 508 509 template <typename F> 510 constexpr *tagged lazy default* |logical or operator|_\(F&) const; 511 512 static keyword<Tag> const& instance; 513 514 static keyword<Tag>& get_\(); 515 }; 516 517.. |assignment operator| replace:: ``operator=`` 518.. _assignment operator: 519 520``operator=`` 521 522:Synopsis: 523 524.. parsed-literal:: 525 526 template <typename T> 527 constexpr |ArgumentPack|_ operator=(T const& value) const; 528 529 template <typename T> 530 constexpr |ArgumentPack|_ operator=(T& value) const; 531 532 template <typename T> 533 constexpr |ArgumentPack|_ operator=(T const&& value) const; 534 535 template <typename T> 536 constexpr |ArgumentPack|_ operator=(T&& value) const; 537 538:Requires: one of the following: 539 540* The nested ``qualifier`` type of ``Tag`` must be ``forward_reference``. 541* To use the ``const`` lvalue reference overload, ``T`` must be scalar, or 542 the nested ``qualifier`` type of ``Tag`` must be ``in_reference``. 543* To use the mutable lvalue reference overload, the nested ``qualifier`` 544 type of ``Tag`` must be ``out_reference`` or ``in_out_reference``, and 545 ``T`` must not be ``const``-qualified. 546* To use the ``const`` rvalue reference overload for non-scalar ``T``, the 547 nested ``qualifier`` type of ``Tag`` must be ``in_reference``. 548* To use the mutable rvalue reference overload for non-scalar ``T``, the 549 nested ``qualifier`` type of ``Tag`` must be ``consume_reference`` or 550 ``move_from_reference``. 551 552:Returns: an |ArgumentPack|_ containing a single |tagged reference| to 553 ``value`` with |kw|_ ``Tag`` 554 555.. |bitwise or operator| replace:: ``operator|`` 556.. _bitwise or operator: 557 558``operator|`` 559 560:Synopsis: 561 562.. parsed-literal:: 563 564 template <typename T> 565 constexpr *tagged default* operator|(T const& x) const; 566 567 template <typename T> 568 constexpr *tagged default* operator|(T& x) const; 569 570 template <typename T> 571 constexpr *tagged default* operator|(T const&& x) const; 572 573 template <typename T> 574 constexpr *tagged default* operator|(T&& x) const; 575 576:Requires: one of the following: 577 578* The nested ``qualifier`` type of ``Tag`` must be ``forward_reference``. 579* To use the ``const`` lvalue reference overload, ``T`` must be scalar, or 580 the nested ``qualifier`` type of ``Tag`` must be ``in_reference``. 581* To use the mutable lvalue reference overload, the nested ``qualifier`` 582 type of ``Tag`` must be ``out_reference`` or ``in_out_reference``, and 583 ``T`` must not be ``const``-qualified. 584* To use the ``const`` rvalue reference overload for non-scalar ``T``, the 585 nested ``qualifier`` type of ``Tag`` must be ``in_reference``. 586* To use the mutable rvalue reference overload for non-scalar ``T``, the 587 nested ``qualifier`` type of ``Tag`` must be ``consume_reference`` or 588 ``move_from_reference``. 589 590:Returns: a |tagged default| with *value* ``x`` and |kw|_ ``Tag``. 591 592.. |logical or operator| replace:: ``operator||`` 593.. _logical or operator: 594 595``operator||`` 596 597:Synopsis: 598 599.. parsed-literal:: 600 601 template <typename F> 602 constexpr *tagged lazy default* operator||(F const& g) const; 603 604 template <typename F> 605 constexpr *tagged lazy default* operator||(F& g) const; 606 607:Requires: ``g()`` must be valid, with type 608 |boost_result_of|_\ ``<F()>::type``. [#no_result_of]_ 609 610:Returns: a |tagged lazy default| with *value* ``g`` and |kw|_ ``Tag``. 611 612.. _instance: 613 614``instance`` 615 616:Synopsis: 617 618.. parsed-literal:: 619 620 static keyword<Tag> const& instance; 621 622:Returns: a “singleton instance”: the same object will be returned on each 623 invocation of ``instance``. 624 625:Thread Safety: 626 ``instance`` can be accessed from multiple threads simultaneously. 627 628.. _get: 629 630``get`` 631 632:Synopsis: 633 634.. parsed-literal:: 635 636 static keyword<Tag>& get\(); 637 638.. admonition:: Deprecated 639 640 This function has been deprecated in favor of ``instance``. 641 642:Returns: a “singleton instance”: the same object will be returned on each 643 invocation of ``get()``. 644 645:Thread Safety: ``get()`` can be called from multiple threads simultaneously. 646 647.. |template_keyword| replace:: ``template_keyword`` 648.. _template_keyword: 649 650``template_keyword`` 651-------------------- 652 653This class template encapsulates a named template parameter. Every type 654generated by the |BOOST_PARAMETER_TEMPLATE_KEYWORD|_ macro is a specialization 655of |template_keyword|. 656 657:Defined in: |template_keyword_header|_ 658 659.. parsed-literal:: 660 661 template <typename Tag, typename T> 662 struct template_keyword 663 { 664 typedef Tag key_type; 665 typedef T value_type; 666 typedef *implementation defined* reference; 667 }; 668 669The |ntp_cpp|_ test program demonstrates proper usage of this class template. 670 671.. |parameters| replace:: ``parameters`` 672.. _parameters: 673 674``parameters`` 675-------------- 676 677Provides an interface for assembling the actual arguments to a `forwarding 678function` into an |ArgumentPack|, in which any |positional| arguments will be 679tagged according to the corresponding template argument to ``parameters``. 680 681.. _forwarding function: `forwarding functions`_ 682 683:Defined in: |parameters_header|_ 684 685.. parsed-literal:: 686 687 template <typename ...PSpec> 688 struct parameters 689 { 690 template <typename ...Args> 691 struct |match|_ 692 { 693 typedef … type; 694 }; 695 696 template <typename ...Args> 697 |ArgumentPack|_ |function call operator|_\(Args&&... args) const; 698 }; 699 700:Requires: Each element in the ``PSpec`` parameter pack must be a model of 701 |ParameterSpec|_. 702 703.. Note:: 704 705 In this section, ``R`` ## *i* and ``K`` ## *i* are defined as 706 follows, for any argument type ``A`` ## *i*: 707 708 | let ``D0`` the set [d0, …, d ## *j*] of all **deduced** 709 | *parameter specs* in the ``PSpec`` parameter pack 710 | ``R`` ## *i* is the |intended argument type| of ``A`` ## *i* 711 | 712 | if ``A`` ## *i* is a result type of ``keyword<T>::`` |assignment operator|_ 713 | then 714 | ``K`` ## *i* is ``T`` 715 | else 716 | if some ``A`` ## *j* where *j* ≤ *i* is a result type of 717 | ``keyword<T>::`` |assignment operator|_ 718 | *or* some ``P`` ## *j* in *j* ≤ *i* is **deduced** 719 | then 720 | if some *parameter spec* ``d`` ## *j* in ``D`` ## *i* 721 | matches ``A`` ## *i* 722 | then 723 | ``K`` ## *i* is the |keyword tag type| of ``d`` ## *j*. 724 | ``D``:sub:`i+1` is ``D`` ## *i* - [ ``d`` ## *j*] 725 | else 726 | ``K`` ## *i* is the |keyword tag type| of ``P`` ## *i*. 727 728.. |match| replace:: ``match`` 729.. _match: 730 731``match`` 732 A `Metafunction`_ used to remove a `forwarding function`_ from overload 733 resolution. 734 735:Returns: if all elements in ``Params...`` are *satisfied* (see below), then 736 ``parameters<Params...>``. Otherwise, ``match<Args...>::type`` is not 737 defined. 738 739Each element ``P`` in ``Params...`` is **satisfied** if either: 740 741* ``P`` is the *unspecified* default 742* **or**, ``P`` is a *keyword tag type* 743* **or**, ``P`` is |optional|_ ``<X,F>`` and either 744 - ``X`` is not ``K`` ## *i* for any *i*, 745 - **or** ``X`` is some ``K`` ## *i* and ``mpl::apply<F,R`` ## *i*\ 746 ``>::type::value`` is ``true`` 747* **or**, ``P`` is |required|_ ``<X,F>``, and 748 - ``X`` is some ``K`` ## *i*, **and** 749 - ``mpl::apply<F,R`` ## *i* ``>::type::value`` is ``true`` 750 751.. |function call operator| replace:: ``operator()`` 752.. _function call operator: 753 754``operator()`` 755 756:Synopsis: 757 758.. parsed-literal:: 759 760 template <typename ...Args> 761 |ArgumentPack|_ operator()(Args&&... args) const; 762 763:Returns: An |ArgumentPack|_ containing, for each ``a`` ## *i*, 764 765 - if ``a`` ## *i* is a single-element |ArgumentPack|, its element 766 - Otherwise, a |tagged reference| with |kw|_ ``K`` ## *i* and *value* 767 ``a`` ## *i* 768 769.. |optional| replace:: ``optional`` 770.. |required| replace:: ``required`` 771 772.. _optional: 773.. _required: 774 775``optional``, ``required`` 776-------------------------- 777 778These templates describe the requirements on a function parameter. 779 780``optional`` is defined in: |optional_header|_ 781 782``required`` is defined in: |required_header|_ 783 784Both headers are included by: |preprocessor_header|_ 785 786:Specializations model: |ParameterSpec|_ 787 788.. parsed-literal:: 789 790 template <typename Tag, typename Predicate = *unspecified*> 791 struct optional; 792 793 template <typename Tag, typename Predicate = *unspecified*> 794 struct required; 795 796The default value of ``Predicate`` is an unspecified `MPL Binary Metafunction 797Class`_ that returns ``mpl::true_`` for any argument. If 798|BOOST_PARAMETER_CAN_USE_MP11|_ is defined, then the default value of 799``Predicate`` is also a |Boost_MP11|_-style quoted metafunction that returns 800``mp11::mp_true`` for any argument. 801 802.. |deduced| replace:: ``deduced`` 803.. _deduced: 804 805``deduced`` 806----------- 807 808This template is used to wrap the *keyword tag* argument to 809``optional`` or ``required``. 810 811:Defined in: |deduced_header|_ 812:Included by: |preprocessor_header|_ 813 814.. parsed-literal:: 815 816 template <typename Tag> 817 struct deduced; 818 819:Requires: nothing 820 821////////////////////////////////////////////////////////////////////////////// 822 823Metafunctions 824============= 825 826A `Metafunction`_ is conceptually a function that operates on, and returns, 827C++ types. 828 829.. |binding| replace:: ``binding`` 830.. _binding: 831 832``binding`` 833----------- 834 835Returns the result type of indexing an argument pack with a 836|keyword tag type| or with a |tagged default|. 837 838:Defined in: |binding_header|_ 839 840.. parsed-literal:: 841 842 template <typename A, typename K, typename D = void\_> 843 struct binding 844 { 845 typedef … type; 846 }; 847 848:Requires: ``A`` must be a model of |ArgumentPack|_. 849 850:Returns: the reference type of the |tagged reference| in ``A`` having 851 |keyword tag type| ``K``, if any. If no such |tagged reference| exists, 852 returns ``D``. 853 854.. |lazy_binding| replace:: ``lazy_binding`` 855.. _lazy_binding: 856 857``lazy_binding`` 858---------------- 859 860Returns the result type of indexing an argument pack with a 861|tagged lazy default|. 862 863:Defined in: |binding_header|_ 864 865.. parsed-literal:: 866 867 template <typename A, typename K, typename F> 868 struct lazy_binding 869 { 870 typedef … type; 871 }; 872 873:Requires: ``A`` must be a model of |ArgumentPack|_. 874 875:Returns: the reference type of the |tagged reference| in ``A`` having 876 |keyword tag type| ``K``, if any. If no such |tagged reference| exists, 877 returns |boost_result_of|_\ ``<F()>::type``. [#no_result_of]_ 878 879.. |value_type| replace:: ``value_type`` 880.. _value_type: 881 882``value_type`` 883-------------- 884 885Returns the result type of indexing an argument pack with a 886|keyword tag type| or with a |tagged default|. 887 888:Defined in: |value_type_header|_ 889 890.. parsed-literal:: 891 892 template <typename A, typename K, typename D = void\_> 893 struct value_type 894 { 895 typedef … type; 896 }; 897 898:Requires: ``A`` must be a model of |ArgumentPack|_. 899 900:Returns: the (possibly const-qualified) type of the |tagged reference| in 901 ``A`` having |keyword tag type| ``K``, if any. If no such 902 |tagged reference| exists, returns ``D``. Equivalent to: 903 904 .. parsed-literal:: 905 906 typename |boost_remove_reference|_\< 907 typename |binding|_\<A, K, D>::type 908 >::type 909 910 … when ``D`` is not a reference type. 911 912.. |lazy_value_type| replace:: ``lazy_value_type`` 913.. _lazy_value_type: 914 915``lazy_value_type`` 916------------------- 917 918Returns the result type of indexing an argument pack with a 919|tagged lazy default|. 920 921:Defined in: |value_type_header|_ 922 923.. parsed-literal:: 924 925 template <typename A, typename K, typename F> 926 struct lazy_value_type 927 { 928 typedef … type; 929 }; 930 931:Requires: ``A`` must be a model of |ArgumentPack|_. 932 933:Returns: the (possibly const-qualified) type of the |tagged reference| in 934 ``A`` having |keyword tag type| ``K``, if any. If no such 935 |tagged reference| exists, returns 936 |boost_result_of|_\ ``<F()>::type``. [#no_result_of]_ 937 938.. |are_tagged_arguments| replace:: ``are_tagged_arguments`` 939.. _are_tagged_arguments: 940 941``are_tagged_arguments`` 942------------------------ 943 944:Defined in: |are_tagged_arguments_header|_ 945 946.. parsed-literal:: 947 948 template <typename T0, typename ...Pack> 949 struct are_tagged_arguments 950 // : |mpl_true|_\ if T0 and all elements in Pack are 951 // tagged reference types, |mpl_false|_\ otherwise. 952 { 953 }; 954 955:Returns: 956 ``mpl::true_`` if ``T0`` and all elements in parameter pack ``Pack`` are 957 |tagged reference| types, ``mpl::false_`` otherwise. 958 959:Example usage: 960 961When implementing a Boost.Parameter-enabled constructor for a container that 962conforms to the C++ standard, one needs to remember that the standard requires 963the presence of other constructors that are typically defined as templates, 964such as range constructors. To avoid overload ambiguities between the two 965constructors, use this metafunction in conjunction with ``disable_if`` to 966define the range constructor. 967 968.. parsed-literal:: 969 970 template <typename B> 971 class frontend : public B 972 { 973 struct _enabler 974 { 975 }; 976 977 public: 978 |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_\(frontend, (B)) 979 980 template <typename Iterator> 981 frontend( 982 Iterator itr 983 , Iterator itr_end 984 , typename |boost_disable_if|_\< 985 are_tagged_arguments<Iterator> 986 , _enabler 987 >::type = _enabler() 988 ) : B(itr, itr_end) 989 { 990 } 991 }; 992 993.. |is_argument_pack| replace:: ``is_argument_pack`` 994.. _is_argument_pack: 995 996``is_argument_pack`` 997-------------------- 998 999:Defined in: |is_argument_pack_header|_ 1000 1001.. parsed-literal:: 1002 1003 template <typename T> 1004 struct is_argument_pack 1005 // : |mpl_true|_\ if T is a model of |ArgumentPack|_\, 1006 // |mpl_false|_\ otherwise. 1007 { 1008 }; 1009 1010:Returns: 1011 ``mpl::true_`` if ``T`` is a model of |ArgumentPack|_, ``mpl::false_`` 1012 otherwise. 1013 1014:Example usage: 1015 1016To avoid overload ambiguities between a constructor that takes in an 1017|ArgumentPack|_ and a templated conversion constructor, use this 1018metafunction in conjunction with ``enable_if``. 1019 1020.. parsed-literal:: 1021 1022 |BOOST_PARAMETER_NAME|_\(a0) 1023 1024 template <typename T> 1025 class backend0 1026 { 1027 struct _enabler 1028 { 1029 }; 1030 1031 T a0; 1032 1033 public: 1034 template <typename ArgPack> 1035 explicit backend0( 1036 ArgPack const& args 1037 , typename |boost_enable_if|_\< 1038 is_argument_pack<ArgPack> 1039 , _enabler 1040 >::type = _enabler() 1041 ) : a0(args[_a0]) 1042 { 1043 } 1044 1045 template <typename U> 1046 backend0( 1047 backend0<U> const& copy 1048 , typename |boost_enable_if|_\< 1049 |boost_is_convertible|_\<U,T> 1050 , _enabler 1051 >::type = _enabler() 1052 ) : a0(copy.get_a0()) 1053 { 1054 } 1055 1056 T const& get_a0() const 1057 { 1058 return this->a0; 1059 } 1060 }; 1061 1062.. |result_of_compose| replace:: ``result_of::compose`` 1063.. _result_of_compose: 1064 1065``result_of::compose`` 1066---------------------- 1067 1068Returns the result type of the |compose|_ function. 1069 1070:Defined in: |compose_header|_ 1071 1072.. parsed-literal:: 1073 1074 template <typename ...TaggedArgs> 1075 struct compose 1076 : |boost_enable_if|_\< 1077 |are_tagged_arguments|_\<T0,Pack...> 1078 , |ArgumentPack|_ 1079 > 1080 { 1081 }; 1082 1083 template <> 1084 struct compose<> 1085 { 1086 typedef *empty* |ArgumentPack|_ type; 1087 }; 1088 1089:Requires: All elements in ``TaggedArgs`` must be |tagged reference| types, if 1090 specified. 1091 1092:Returns: the result type of the |compose|_ function. 1093 1094////////////////////////////////////////////////////////////////////////////// 1095 1096Function Templates 1097================== 1098 1099.. |compose| replace:: ``compose`` 1100.. _compose: 1101 1102``compose`` 1103----------- 1104 1105:Defined in: |compose_header|_ 1106 1107.. parsed-literal:: 1108 1109 template <typename ...Pack> 1110 constexpr typename |result_of_compose|_\<Pack...>::type 1111 compose(Pack const&... args); 1112 1113This function facilitates easier variadic argument composition. It is used by 1114the |BOOST_PARAMETER_NO_SPEC_FUNCTION|_, 1115|BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION|_, 1116|BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION|_, 1117|BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR|_, 1118|BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR|_, 1119|BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_, and 1120|BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR|_ code generation macros. You 1121can use it to write your own code generation macros if the ones provided by 1122this library do not suffice. 1123 1124Unlike the |tagged reference| comma operator, the ``compose()`` function is 1125variadic, as mentioned before. However, the |tagged reference| comma operator 1126can be invoked indefinitely and therefore does not limit the size of the 1127resulting |ArgumentPack|, while the ``compose()`` function cannot take in more 1128than |BOOST_PARAMETER_COMPOSE_MAX_ARITY|_ arguments for compilers that do not 1129support perfect forwarding. 1130 1131:Requires: All elements in ``args`` must be |tagged reference| objects, if 1132 specified. 1133 1134:Returns: an |ArgumentPack|_ containing all elements in ``args``, if 1135 specified; an empty |ArgumentPack|_ otherwise. 1136 1137:Example usage: 1138 1139.. parsed-literal:: 1140 1141 BOOST_PARAMETER_NAME(index) 1142 BOOST_PARAMETER_NAME(name) 1143 1144 template <typename ArgumentPack> 1145 int print_name_and_index(ArgumentPack const& args) 1146 { 1147 std::cout << "index = " << args[_index]; 1148 std::cout << "name = " << args[_name]; 1149 std::cout << "; " << std::endl; 1150 return 0; 1151 } 1152 1153 int y = print_name_and_index(compose(_index = 3, _name = "jones")); 1154 1155The |compose_cpp|_ test program shows more examples using this function. 1156 1157////////////////////////////////////////////////////////////////////////////// 1158 1159Code Generation Macros 1160====================== 1161 1162Macros in this section can be used to ease the writing of code 1163using the Parameter library by eliminating repetitive boilerplate. 1164 1165.. |BOOST_PARAMETER_FUNCTION| replace:: ``BOOST_PARAMETER_FUNCTION`` 1166.. _BOOST_PARAMETER_FUNCTION: 1167 1168``BOOST_PARAMETER_FUNCTION(result, name, tag_namespace, arguments)`` 1169-------------------------------------------------------------------- 1170 1171:Defined in: |preprocessor_header|_ 1172 1173Generates a function that can take in positional arguments, composed 1174arguments, named arguments, and deduced arguments. 1175 1176:Example usage: 1177 1178The return type of each of the following function templates falls under a 1179different value category. 1180 1181.. parsed-literal:: 1182 1183 template <std::size_t N> 1184 |std_bitset|_\<N + 1> rvalue_bitset() 1185 { 1186 return |std_bitset|_\<N + 1>(); 1187 } 1188 1189 template <std::size_t N> 1190 |std_bitset|_\<N + 1> const rvalue_const_bitset() 1191 { 1192 return |std_bitset|_\<N + 1>(); 1193 } 1194 1195 template <std::size_t N> 1196 |std_bitset|_\<N + 1>& lvalue_bitset() 1197 { 1198 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 1199 return lset; 1200 } 1201 1202 template <std::size_t N> 1203 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 1204 { 1205 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 1206 return clset; 1207 } 1208 1209The ``U::evaluate_category`` static member function template has a simple job: 1210to return the correct value category when passed in an object returned by one 1211of the functions defined above. Assume that 1212|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 1213 1214.. parsed-literal:: 1215 1216 enum invoked 1217 { 1218 passed_by_lvalue_reference_to_const 1219 , passed_by_lvalue_reference 1220 , passed_by_rvalue_reference_to_const 1221 , passed_by_rvalue_reference 1222 }; 1223 1224 struct U 1225 { 1226 template <std::size_t N> 1227 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 1228 { 1229 return passed_by_lvalue_reference_to_const; 1230 } 1231 1232 template <std::size_t N> 1233 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 1234 { 1235 return passed_by_lvalue_reference; 1236 } 1237 1238 template <std::size_t N> 1239 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 1240 { 1241 return passed_by_rvalue_reference_to_const; 1242 } 1243 1244 template <std::size_t N> 1245 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 1246 { 1247 return passed_by_rvalue_reference; 1248 } 1249 }; 1250 1251Define the named parameters that will comprise the argument specification that 1252this macro will use. Ensure that all their tag types are in the same 1253namespace, which is ``kw`` in this case. The identifiers with leading 1254underscores can be passed to the bracket operator of ``args`` to extract the 1255same argument to which the corresponding named parameter (without underscores) 1256is bound, as will be shown later. 1257 1258.. parsed-literal:: 1259 1260 |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc)) 1261 |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr)) 1262 |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc)) 1263 |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr)) 1264 1265Use the macro as a substitute for a normal function header. Enclose the 1266return type ``bool`` in parentheses. For each parameter, also enclose the 1267expected value type in parentheses. Since the value types are mutually 1268exclusive, you can wrap the parameters in a ``(deduced …)`` 1269clause. Otherwise, just as with a normal function, the order in which you 1270specify the parameters determines their position. Also, just as with a normal 1271function, optional parameters have default values, whereas required parameters 1272do not. Within the function body, either simply use the parameter name or 1273pass the matching identifier with the leading underscore to the bracket 1274operator of ``args`` to extract the corresponding argument. Note that the 1275second method doesn't require ``std::forward`` to preserve value categories. 1276 1277.. parsed-literal:: 1278 1279 BOOST_PARAMETER_FUNCTION((bool), evaluate, kw, 1280 (deduced 1281 (required 1282 (lrc, (|std_bitset|_\<1>)) 1283 (lr, (|std_bitset|_\<2>)) 1284 ) 1285 (optional 1286 (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>()) 1287 (rr, (|std_bitset|_\<4>), rvalue_bitset<3>()) 1288 ) 1289 ) 1290 ) 1291 { 1292 BOOST_TEST_EQ( 1293 passed_by_lvalue_reference_to_const 1294 , U::evaluate_category<0>(lrc) 1295 ); 1296 BOOST_TEST_EQ( 1297 passed_by_lvalue_reference 1298 , U::evaluate_category<1>(lr) 1299 ); 1300 BOOST_TEST_EQ( 1301 passed_by_rvalue_reference_to_const 1302 , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0)) 1303 ); 1304 BOOST_TEST_EQ( 1305 passed_by_rvalue_reference 1306 , U::evaluate_category<3>(args[_rr0]) 1307 ); 1308 1309 return true; 1310 } 1311 1312The following function calls are legal. 1313 1314.. parsed-literal:: 1315 1316 evaluate( // positional arguments 1317 lvalue_const_bitset<0>() 1318 , lvalue_bitset<1>() 1319 , rvalue_const_bitset<2>() 1320 , rvalue_bitset<3>() 1321 ); 1322 evaluate( // positional arguments 1323 lvalue_const_bitset<0>() 1324 , lvalue_bitset<1>() 1325 ); 1326 evaluate(( // composed arguments 1327 _rr0 = rvalue_bitset<3>() 1328 , _lrc0 = lvalue_const_bitset<0>() 1329 , _lr0 = lvalue_bitset<1>() 1330 , _rrc0 = rvalue_const_bitset<2>() 1331 )); 1332 evaluate( // named arguments 1333 _rr0 = rvalue_bitset<3>() 1334 , _lrc0 = lvalue_const_bitset<0>() 1335 , _lr0 = lvalue_bitset<1>() 1336 , _rrc0 = rvalue_const_bitset<2>() 1337 ); 1338 evaluate( // named arguments 1339 _lr0 = lvalue_bitset<1>() 1340 , _lrc0 = lvalue_const_bitset<0>() 1341 ); 1342 1343Because the parameters were wrapped in a ``(deduced …)`` clause, the following 1344function calls are also legal. 1345 1346.. parsed-literal:: 1347 1348 evaluate( // deduced arguments 1349 rvalue_bitset<3>() 1350 , lvalue_const_bitset<0>() 1351 , lvalue_bitset<1>() 1352 , rvalue_const_bitset<2>() 1353 ); 1354 evaluate( // deduced arguments 1355 lvalue_bitset<1>() 1356 , lvalue_const_bitset<0>() 1357 ); 1358 1359The |preprocessor_cpp|_, |preprocessor_deduced_cpp|_, and 1360|preprocessor_eval_cat_cpp|_ test programs demonstrate proper usage of this 1361macro. 1362 1363**Macro parameters:** 1364 1365* ``result`` is the parenthesized return type of the function. 1366* ``name`` is the base name of the function; it determines the name of the 1367 generated forwarding functions. 1368* ``tag_namespace`` is the namespace in which the keywords used by the 1369 function resides. 1370* ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of 1371 *argument-specifiers*, as defined below. 1372 1373**Argument specifiers syntax:** 1374 1375.. parsed-literal:: 1376 1377 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 1378 1379 specifier-group0 ::= *specifier-group1* | 1380 ( 1381 '**(**' '**deduced**' 1382 *specifier-group1* {*specifier-group1*\ } 1383 '**)**' 1384 ) 1385 1386 specifier-group1 ::= 1387 ( 1388 '**(**' '**optional**' 1389 *optional-specifier* {*optional-specifier*\ } 1390 '**)**' 1391 ) | ( 1392 '**(**' '**required**' 1393 *required-specifier* {*required-specifier*\ } 1394 '**)**' 1395 ) 1396 1397 optional-specifier ::= 1398 '**(**' 1399 *argument-name* '**,**' *restriction* '**,**' *default-value* 1400 ')' 1401 1402 required-specifier ::= 1403 '**(**' *argument-name* '**,**' *restriction* ')' 1404 1405 restriction ::= 1406 ( '**\***' '**(**' *mfc* '**)**' ) | 1407 ( '**(**' *type-name* '**)**' ) | 1408 '**\***' 1409 1410* ``argument-name`` is any valid C++ identifier. 1411* ``default-value`` is any valid C++ expression; if necessary, user code can 1412 compute it in terms of ``previous-name ## _type``, where ``previous-name`` 1413 is the ``argument-name`` in a previous ``specifier-group0`` or 1414 ``specifier-group1``. *This expression will be invoked exactly once.* 1415* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 1416 be the type of the corresponding ``argument-name``, whose second argument 1417 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 1418 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 1419 of ``previous-name ## _type``. 1420* ``type-name`` is either the name of a **target type** or an `MPL Binary 1421 Metafunction Class`_ whose first argument will be the type of the 1422 corresponding ``argument-name``, whose second argument will be the entire 1423 |ArgumentPack|_, and whose return type is the **target type**. If 1424 ``restriction`` uses this form, then the type of the generated name 1425 ``argument-name ## _type`` will be computed in terms of the **target 1426 type**, and the generated reference ``argument-name`` (but not its 1427 corresponding entry in ``args``) will be cast to that type. 1428 1429**Approximate expansion:** 1430 1431Where: 1432 1433* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 1434* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 1435 1436.. parsed-literal:: 1437 1438 // If **result** is a template instantiation of |boost_enable_if|_\, 1439 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 1440 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 1441 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 1442 // |std_enable_if|_\: 1443 template <typename Args> 1444 using boost_param_result\_ ## __LINE__ ## **name** = **result**; 1445 1446 // If **result** is a simple return type: 1447 template <typename Args> 1448 struct boost_param_result\_ ## __LINE__ ## **name** 1449 { 1450 typedef **result** type; 1451 }; 1452 1453 struct boost_param_params\_ ## __LINE__ ## **name** 1454 : |parameters|_\< 1455 *list of parameter specifications, based on arguments* 1456 > 1457 { 1458 }; 1459 1460 typedef boost_param_params\_ ## __LINE__ ## **name** 1461 boost_param_parameters\_ ## __LINE__ ## **name**; 1462 1463 template <typename Args> 1464 typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type 1465 boost_param_impl ## __LINE__ ## **name**\ (Args const&); 1466 1467 template <typename A0, …, typename A ## **n**> 1468 **result** **name**\ ( 1469 A0&& a0, …, A ## **n**\ && a ## **n** 1470 , typename boost_param_parameters\_ ## __LINE__ ## **name** 1471 ::match<A0, …, A ## **n**>::type 1472 = boost_param_parameters\_ ## __LINE__ ## **name**\ () 1473 ) 1474 { 1475 return boost_param_impl ## __LINE__ ## **name**\ ( 1476 boost_param_parameters\_ ## __LINE__ ## **name**\ ()( 1477 |std_forward|_\<A0>(a0) 1478 , … 1479 , |std_forward|_\<A ## **n**>(a ## **n**) 1480 ) 1481 ); 1482 } 1483 1484 :vellipsis:`⋮` 1485 1486 template <typename A0, …, typename A ## **m**> 1487 **result** **name**\ ( 1488 A0&& a0, …, A ## **m**\ && a ## **m** 1489 , typename boost_param_parameters\_ ## __LINE__ ## **name** 1490 ::match<A0, …, A ## **m**>::type 1491 = boost_param_parameters\_ ## __LINE__ ## **name**\ () 1492 ) 1493 { 1494 return boost_param_impl ## __LINE__ ## **name**\ ( 1495 boost_param_parameters\_ ## __LINE__ ## **name**\ ()( 1496 |std_forward|_\<A0>(a0) 1497 , … 1498 , |std_forward|_\<A ## **m**>(a ## **m**) 1499 ) 1500 ); 1501 } 1502 1503 template < 1504 typename ResultType 1505 , typename Args 1506 , typename *argument name* ## **0** ## _type 1507 , … 1508 , typename *argument name* ## **n** ## _type 1509 > 1510 ResultType 1511 boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ ( 1512 (ResultType(*)()) 1513 , Args const& args 1514 , *argument name* ## **0** ## _type&& *argument name* ## **0** 1515 , … 1516 , *argument name* ## **n** ## _type&& *argument name* ## **m** 1517 ); 1518 1519 :vellipsis:`⋮` 1520 1521 template < 1522 typename ResultType 1523 , typename Args 1524 , typename *argument name* ## **0** ## _type 1525 , … 1526 , typename *argument name* ## **m** ## _type 1527 > 1528 ResultType 1529 boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ ( 1530 (ResultType(*)()) 1531 , Args const& args 1532 , *argument name* ## **0** ## _type&& *argument name* ## **0** 1533 , … 1534 , *argument name* ## **m** ## _type&& *argument name* ## **m** 1535 ); 1536 1537 template <typename Args> 1538 typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type 1539 boost_param_impl ## __LINE__ ## **name**\ (Args const& args) 1540 { 1541 return boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ ( 1542 static_cast< 1543 typename boost_param_result\_ ## __LINE__ ## **name**\ < 1544 Args 1545 >::type(*)() 1546 >(|std_nullptr|_\) 1547 , args 1548 , |std_forward|_\< 1549 typename |value_type|_\< 1550 Args 1551 , *keyword tag type of required parameter* ## **0** 1552 >::type 1553 >(args[ *keyword object of required parameter* ## **0**]) 1554 , … 1555 , |std_forward|_\< 1556 typename |value_type|_\< 1557 Args 1558 , *keyword tag type of required parameter* ## **n** 1559 >::type 1560 >(args[ *keyword object of required parameter* ## **n**]) 1561 ); 1562 } 1563 1564 template < 1565 typename ResultType 1566 , typename Args 1567 , typename *argument name* ## **0** ## _type 1568 , … 1569 , typename *argument name* ## **n** ## _type 1570 > 1571 ResultType 1572 boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ ( 1573 (ResultType(*)()) 1574 , Args const& args 1575 , *argument name* ## **0** ## _type&& *argument name* ## **0** 1576 , … 1577 , *argument name* ## **n** ## _type&& *argument name* ## **n** 1578 ) 1579 { 1580 return boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ ( 1581 static_cast<ResultType(*)()>(|std_nullptr|_\) 1582 , (args, *keyword object of optional parameter* ## **n + 1** = 1583 *default value of optional parameter* ## **n + 1** 1584 ) 1585 , |std_forward|_\<*argument name* ## **0** ## _type>( 1586 *argument name* ## **0** 1587 ) 1588 , … 1589 , |std_forward|_\<*argument name* ## **n** ## _type>( 1590 *argument name* ## **n** 1591 ) 1592 , |std_forward|_\< 1593 typename |value_type|_\< 1594 Args 1595 , *keyword tag type of optional parameter* ## **n + 1** 1596 >::type 1597 >(*default value of optional parameter* ## **n + 1**) 1598 ); 1599 } 1600 1601 :vellipsis:`⋮` 1602 1603 template < 1604 typename ResultType 1605 , typename Args 1606 , typename *argument name* ## **0** ## _type 1607 , … 1608 , typename *argument name* ## **m** ## _type 1609 > 1610 ResultType 1611 boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ ( 1612 (ResultType(*)()) 1613 , Args const& args 1614 , *argument name* ## **0** ## _type&& *argument name* ## **0** 1615 , … 1616 , *argument name* ## **m** ## _type&& *argument name* ## **m** 1617 ) 1618 1619.. |BOOST_PARAMETER_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_MEMBER_FUNCTION`` 1620.. _BOOST_PARAMETER_MEMBER_FUNCTION: 1621 1622``BOOST_PARAMETER_MEMBER_FUNCTION(result, name, tag_namespace, arguments)`` 1623--------------------------------------------------------------------------- 1624 1625:Defined in: |preprocessor_header|_ 1626 1627Generates a member function that can take in positional arguments, composed 1628arguments, named arguments, and deduced arguments. 1629 1630:Example usage: 1631 1632The return type of each of the following function templates falls under a 1633different value category. 1634 1635.. parsed-literal:: 1636 1637 template <std::size_t N> 1638 |std_bitset|_\<N + 1> rvalue_bitset() 1639 { 1640 return |std_bitset|_\<N + 1>(); 1641 } 1642 1643 template <std::size_t N> 1644 |std_bitset|_\<N + 1> const rvalue_const_bitset() 1645 { 1646 return |std_bitset|_\<N + 1>(); 1647 } 1648 1649 template <std::size_t N> 1650 |std_bitset|_\<N + 1>& lvalue_bitset() 1651 { 1652 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 1653 return lset; 1654 } 1655 1656 template <std::size_t N> 1657 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 1658 { 1659 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 1660 return clset; 1661 } 1662 1663The ``U::evaluate_category`` static member function template has a simple job: 1664to return the correct value category when passed in an object returned by one 1665of the functions defined above. Assume that 1666|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 1667 1668.. parsed-literal:: 1669 1670 enum invoked 1671 { 1672 passed_by_lvalue_reference_to_const 1673 , passed_by_lvalue_reference 1674 , passed_by_rvalue_reference_to_const 1675 , passed_by_rvalue_reference 1676 }; 1677 1678 struct U 1679 { 1680 template <std::size_t N> 1681 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 1682 { 1683 return passed_by_lvalue_reference_to_const; 1684 } 1685 1686 template <std::size_t N> 1687 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 1688 { 1689 return passed_by_lvalue_reference; 1690 } 1691 1692 template <std::size_t N> 1693 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 1694 { 1695 return passed_by_rvalue_reference_to_const; 1696 } 1697 1698 template <std::size_t N> 1699 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 1700 { 1701 return passed_by_rvalue_reference; 1702 } 1703 }; 1704 1705Define the named parameters that will comprise the argument specification that 1706this macro will use. Ensure that all their tag types are in the same 1707namespace, which is ``kw`` in this case. The identifiers with leading 1708underscores can be passed to the bracket operator of ``args`` to extract the 1709same argument to which the corresponding named parameter (without underscores) 1710is bound, as will be shown later. 1711 1712.. parsed-literal:: 1713 1714 |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc)) 1715 |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr)) 1716 |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc)) 1717 |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr)) 1718 1719Use the macro as a substitute for a normal ``static`` member function 1720header. Enclose the return type ``bool`` in parentheses. For each parameter, 1721also enclose the expected value type in parentheses. Since the value types 1722are mutually exclusive, you can wrap the parameters in a ``(deduced …)`` 1723clause. Otherwise, just as with a normal function, the order in which you 1724specify the parameters determines their position. Also, just as with a normal 1725function, optional parameters have default values, whereas required parameters 1726do not. Within the function body, either simply use the parameter name or 1727pass the matching identifier with the leading underscore to the bracket 1728operator of ``args`` to extract the corresponding argument. Note that the 1729second method doesn't require ``std::forward`` to preserve value categories. 1730 1731.. parsed-literal:: 1732 1733 struct B 1734 { 1735 BOOST_PARAMETER_MEMBER_FUNCTION((bool), static evaluate, kw, 1736 (deduced 1737 (required 1738 (lrc, (|std_bitset|_\<1>)) 1739 (lr, (|std_bitset|_\<2>)) 1740 ) 1741 (optional 1742 (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>()) 1743 (rr, (|std_bitset|_\<4>), rvalue_bitset<3>()) 1744 ) 1745 ) 1746 ) 1747 { 1748 BOOST_TEST_EQ( 1749 passed_by_lvalue_reference_to_const 1750 , U::evaluate_category<0>(lrc) 1751 ); 1752 BOOST_TEST_EQ( 1753 passed_by_lvalue_reference 1754 , U::evaluate_category<1>(lr) 1755 ); 1756 BOOST_TEST_EQ( 1757 passed_by_rvalue_reference_to_const 1758 , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0)) 1759 ); 1760 BOOST_TEST_EQ( 1761 passed_by_rvalue_reference 1762 , U::evaluate_category<3>(args[_rr0]) 1763 ); 1764 1765 return true; 1766 } 1767 }; 1768 1769The following function calls are legal. 1770 1771.. parsed-literal:: 1772 1773 B::evaluate( // positional arguments 1774 lvalue_const_bitset<0>() 1775 , lvalue_bitset<1>() 1776 , rvalue_const_bitset<2>() 1777 , rvalue_bitset<3>() 1778 ); 1779 B::evaluate( // positional arguments 1780 lvalue_const_bitset<0>() 1781 , lvalue_bitset<1>() 1782 ); 1783 B::evaluate(( // composed arguments 1784 _rr0 = rvalue_bitset<3>() 1785 , _lrc0 = lvalue_const_bitset<0>() 1786 , _lr0 = lvalue_bitset<1>() 1787 , _rrc0 = rvalue_const_bitset<2>() 1788 )); 1789 B::evaluate( // named arguments 1790 _rr0 = rvalue_bitset<3>() 1791 , _lrc0 = lvalue_const_bitset<0>() 1792 , _lr0 = lvalue_bitset<1>() 1793 , _rrc0 = rvalue_const_bitset<2>() 1794 ); 1795 B::evaluate( // named arguments 1796 _lr0 = lvalue_bitset<1>() 1797 , _lrc0 = lvalue_const_bitset<0>() 1798 ); 1799 1800Because the parameters were wrapped in a ``(deduced …)`` clause, the following 1801function calls are also legal. 1802 1803.. parsed-literal:: 1804 1805 B::evaluate( // deduced arguments 1806 rvalue_bitset<3>() 1807 , lvalue_const_bitset<0>() 1808 , lvalue_bitset<1>() 1809 , rvalue_const_bitset<2>() 1810 ); 1811 B::evaluate( // deduced arguments 1812 lvalue_bitset<1>() 1813 , lvalue_const_bitset<0>() 1814 ); 1815 1816The |preprocessor_cpp|_ and |preprocessor_eval_cat_cpp|_ test programs 1817demonstrate proper usage of this macro. 1818 1819**Macro parameters:** 1820 1821* ``result`` is the parenthesized return type of the function. 1822* ``name`` is the base name of the function; it determines the name of the 1823 generated forwarding functions. ``name`` may be qualified by the 1824 ``static`` keyword to declare the member function and its helpers as not 1825 associated with any object of the enclosing type. 1826* ``tag_namespace`` is the namespace in which the keywords used by the 1827 function resides. 1828* ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of 1829 *argument-specifiers*, as defined below. 1830 1831**Argument specifiers syntax:** 1832 1833.. parsed-literal:: 1834 1835 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 1836 1837 specifier-group0 ::= *specifier-group1* | 1838 ( 1839 '**(**' '**deduced**' 1840 *specifier-group1* {*specifier-group1*\ } 1841 '**)**' 1842 ) 1843 1844 specifier-group1 ::= 1845 ( 1846 '**(**' '**optional**' 1847 *optional-specifier* {*optional-specifier*\ } 1848 '**)**' 1849 ) | ( 1850 '**(**' '**required**' 1851 *required-specifier* {*required-specifier*\ } 1852 '**)**' 1853 ) 1854 1855 optional-specifier ::= 1856 '**(**' 1857 *argument-name* '**,**' *restriction* '**,**' *default-value* 1858 ')' 1859 1860 required-specifier ::= 1861 '**(**' *argument-name* '**,**' *restriction* ')' 1862 1863 restriction ::= 1864 ( '**\***' '**(**' *mfc* '**)**' ) | 1865 ( '**(**' *type-name* '**)**' ) | 1866 '**\***' 1867 1868* ``argument-name`` is any valid C++ identifier. 1869* ``default-value`` is any valid C++ expression; if necessary, user code can 1870 compute it in terms of ``previous-name ## _type``, where ``previous-name`` 1871 is the ``argument-name`` in a previous ``specifier-group0`` or 1872 ``specifier-group1``. *This expression will be invoked exactly once.* 1873* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 1874 be the type of the corresponding ``argument-name``, whose second argument 1875 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 1876 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 1877 of ``previous-name ## _type``. 1878* ``type-name`` is either the name of a **target type** or an `MPL Binary 1879 Metafunction Class`_ whose first argument will be the type of the 1880 corresponding ``argument-name``, whose second argument will be the entire 1881 |ArgumentPack|_, and whose return type is the **target type**. If 1882 ``restriction`` uses this form, then the type of the generated name 1883 ``argument-name ## _type`` will be computed in terms of the **target 1884 type**, and the generated reference ``argument-name`` (but not its 1885 corresponding entry in ``args``) will be cast to that type. 1886 1887**Approximate expansion:** 1888 1889Where: 1890 1891* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 1892* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 1893 1894.. parsed-literal:: 1895 1896 // If **result** is a template instantiation of |boost_enable_if|_\, 1897 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 1898 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 1899 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 1900 // |std_enable_if|_\: 1901 template <typename Args> 1902 using boost_param_result\_ ## __LINE__ ## **name** = **result**; 1903 1904 // If **result** is a simple return type: 1905 template <typename Args> 1906 struct boost_param_result\_ ## __LINE__ ## **name** 1907 { 1908 typedef **result** type; 1909 }; 1910 1911 struct boost_param_params\_ ## __LINE__ ## **name** 1912 : |parameters|_\< 1913 *list of parameter specifications, based on arguments* 1914 > 1915 { 1916 }; 1917 1918 typedef boost_param_params\_ ## __LINE__ ## **name** 1919 boost_param_parameters\_ ## __LINE__ ## **name**; 1920 1921 template <typename A0, …, typename A ## **n**> 1922 **result** **name**\ ( 1923 A0&& a0, …, A ## **n**\ && a ## **n** 1924 , typename boost_param_parameters\_ ## __LINE__ ## **name** 1925 ::match<A0, …, A ## **n**>::type 1926 = boost_param_parameters\_ ## __LINE__ ## **name**\ () 1927 ) 1928 { 1929 return this->boost_param_impl ## __LINE__ ## **name**\ ( 1930 boost_param_parameters\_ ## __LINE__ ## **name**\ ()( 1931 |std_forward|_\<A0>(a0) 1932 , … 1933 , |std_forward|_\<A ## **n**>(a ## **n**) 1934 ) 1935 ); 1936 } 1937 1938 :vellipsis:`⋮` 1939 1940 template <typename A0, …, typename A ## **m**> 1941 **result** **name**\ ( 1942 A0&& a0, …, A ## **m**\ && a ## **m** 1943 , typename boost_param_parameters\_ ## __LINE__ ## **name** 1944 ::match<A0, …, A ## **m**>::type 1945 = boost_param_parameters\_ ## __LINE__ ## **name**\ () 1946 ) 1947 { 1948 return this->boost_param_impl ## __LINE__ ## **name**\ ( 1949 boost_param_parameters\_ ## __LINE__ ## **name**\ ()( 1950 |std_forward|_\<A0>(a0) 1951 , … 1952 , |std_forward|_\<A ## **m**>(a ## **m**) 1953 ) 1954 ); 1955 } 1956 1957 template <typename Args> 1958 typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type 1959 boost_param_impl ## __LINE__ ## **name**\ (Args const& args) 1960 { 1961 return this->boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ ( 1962 static_cast< 1963 typename boost_param_result\_ ## __LINE__ ## **name**\ < 1964 Args 1965 >::type(*)() 1966 >(|std_nullptr|_\) 1967 , args 1968 , |std_forward|_\< 1969 typename |value_type|_\< 1970 Args 1971 , *keyword tag type of required parameter* ## **0** 1972 >::type 1973 >(args[ *keyword object of required parameter* ## **0**]) 1974 , … 1975 , |std_forward|_\< 1976 typename |value_type|_\< 1977 Args 1978 , *keyword tag type of required parameter* ## **n** 1979 >::type 1980 >(args[ *keyword object of required parameter* ## **n**]) 1981 ); 1982 } 1983 1984 template < 1985 typename ResultType 1986 , typename Args 1987 , typename *argument name* ## **0** ## _type 1988 , … 1989 , typename *argument name* ## **n** ## _type 1990 > 1991 ResultType 1992 boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ ( 1993 (ResultType(*)()) 1994 , Args const& args 1995 , *argument name* ## **0** ## _type&& *argument name* ## **0** 1996 , … 1997 , *argument name* ## **n** ## _type&& *argument name* ## **n** 1998 ) 1999 { 2000 return this->boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ ( 2001 static_cast<ResultType(*)()>(|std_nullptr|_\) 2002 , (args, *keyword object of optional parameter* ## **n + 1** = 2003 *default value of optional parameter* ## **n + 1** 2004 ) 2005 , |std_forward|_\<*argument name* ## **0** ## _type>( 2006 *argument name* ## **0** 2007 ) 2008 , … 2009 , |std_forward|_\<*argument name* ## **n** ## _type>( 2010 *argument name* ## **n** 2011 ) 2012 , |std_forward|_\< 2013 typename |value_type|_\< 2014 Args 2015 , *keyword tag type of optional parameter* ## **n + 1** 2016 >::type 2017 >(*default value of optional parameter* ## **n + 1**) 2018 ); 2019 } 2020 2021 :vellipsis:`⋮` 2022 2023 template < 2024 typename ResultType 2025 , typename Args 2026 , typename *argument name* ## **0** ## _type 2027 , … 2028 , typename *argument name* ## **m** ## _type 2029 > 2030 ResultType 2031 boost_param_dispatch_0boost\_ ## __LINE__ ## **name**\ ( 2032 (ResultType(*)()) 2033 , Args const& args 2034 , *argument name* ## **0** ## _type&& *argument name* ## **0** 2035 , … 2036 , *argument name* ## **m** ## _type&& *argument name* ## **m** 2037 ) 2038 2039.. |BOOST_PARAMETER_CONST_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_CONST_MEMBER_FUNCTION`` 2040.. _BOOST_PARAMETER_CONST_MEMBER_FUNCTION: 2041 2042``BOOST_PARAMETER_CONST_MEMBER_FUNCTION(result, name, tag_ns, arguments)`` 2043-------------------------------------------------------------------------- 2044 2045:Defined in: |preprocessor_header|_ 2046 2047Generates a member function that can take in positional arguments, composed 2048arguments, named arguments, and deduced arguments. 2049 2050:Example usage: 2051 2052The return type of each of the following function templates falls under a 2053different value category. 2054 2055.. parsed-literal:: 2056 2057 template <std::size_t N> 2058 |std_bitset|_\<N + 1> rvalue_bitset() 2059 { 2060 return |std_bitset|_\<N + 1>(); 2061 } 2062 2063 template <std::size_t N> 2064 |std_bitset|_\<N + 1> const rvalue_const_bitset() 2065 { 2066 return |std_bitset|_\<N + 1>(); 2067 } 2068 2069 template <std::size_t N> 2070 |std_bitset|_\<N + 1>& lvalue_bitset() 2071 { 2072 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 2073 return lset; 2074 } 2075 2076 template <std::size_t N> 2077 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 2078 { 2079 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 2080 return clset; 2081 } 2082 2083The ``U::evaluate_category`` static member function template has a simple job: 2084to return the correct value category when passed in an object returned by one 2085of the functions defined above. Assume that 2086|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 2087 2088.. parsed-literal:: 2089 2090 enum invoked 2091 { 2092 passed_by_lvalue_reference_to_const 2093 , passed_by_lvalue_reference 2094 , passed_by_rvalue_reference_to_const 2095 , passed_by_rvalue_reference 2096 }; 2097 2098 struct U 2099 { 2100 template <std::size_t N> 2101 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 2102 { 2103 return passed_by_lvalue_reference_to_const; 2104 } 2105 2106 template <std::size_t N> 2107 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 2108 { 2109 return passed_by_lvalue_reference; 2110 } 2111 2112 template <std::size_t N> 2113 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 2114 { 2115 return passed_by_rvalue_reference_to_const; 2116 } 2117 2118 template <std::size_t N> 2119 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 2120 { 2121 return passed_by_rvalue_reference; 2122 } 2123 }; 2124 2125Define the named parameters that will comprise the argument specification that 2126this macro will use. Ensure that all their tag types are in the same 2127namespace, which is ``kw`` in this case. The identifiers with leading 2128underscores can be passed to the bracket operator of ``args`` to extract the 2129same argument to which the corresponding named parameter (without underscores) 2130is bound, as will be shown later. 2131 2132.. parsed-literal:: 2133 2134 |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc)) 2135 |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr)) 2136 |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc)) 2137 |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr)) 2138 2139Use the macro as a substitute for a normal ``const`` member function 2140header. Enclose the return type ``bool`` in parentheses. For each parameter, 2141also enclose the expected value type in parentheses. Since the value types 2142are mutually exclusive, you can wrap the parameters in a ``(deduced …)`` 2143clause. Otherwise, just as with a normal function, the order in which you 2144specify the parameters determines their position. Also, just as with a normal 2145function, optional parameters have default values, whereas required parameters 2146do not. Within the function body, either simply use the parameter name or 2147pass the matching identifier with the leading underscore to the bracket 2148operator of ``args`` to extract the corresponding argument. Note that the 2149second method doesn't require ``std::forward`` to preserve value categories. 2150 2151.. parsed-literal:: 2152 2153 struct B 2154 { 2155 B() 2156 { 2157 } 2158 2159 BOOST_PARAMETER_CONST_MEMBER_FUNCTION((bool), evaluate, kw, 2160 (deduced 2161 (required 2162 (lrc, (|std_bitset|_\<1>)) 2163 (lr, (|std_bitset|_\<2>)) 2164 ) 2165 (optional 2166 (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>()) 2167 (rr, (|std_bitset|_\<4>), rvalue_bitset<3>()) 2168 ) 2169 ) 2170 ) 2171 { 2172 BOOST_TEST_EQ( 2173 passed_by_lvalue_reference_to_const 2174 , U::evaluate_category<0>(lrc) 2175 ); 2176 BOOST_TEST_EQ( 2177 passed_by_lvalue_reference 2178 , U::evaluate_category<1>(lr) 2179 ); 2180 BOOST_TEST_EQ( 2181 passed_by_rvalue_reference_to_const 2182 , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0)) 2183 ); 2184 BOOST_TEST_EQ( 2185 passed_by_rvalue_reference 2186 , U::evaluate_category<3>(args[_rr0]) 2187 ); 2188 2189 return true; 2190 } 2191 }; 2192 2193The following function calls are legal. 2194 2195.. parsed-literal:: 2196 2197 B const b = B(); 2198 b.evaluate( // positional arguments 2199 lvalue_const_bitset<0>() 2200 , lvalue_bitset<1>() 2201 , rvalue_const_bitset<2>() 2202 , rvalue_bitset<3>() 2203 ); 2204 b.evaluate( // positional arguments 2205 lvalue_const_bitset<0>() 2206 , lvalue_bitset<1>() 2207 ); 2208 b.evaluate(( // composed arguments 2209 _rr0 = rvalue_bitset<3>() 2210 , _lrc0 = lvalue_const_bitset<0>() 2211 , _lr0 = lvalue_bitset<1>() 2212 , _rrc0 = rvalue_const_bitset<2>() 2213 )); 2214 b.evaluate( // named arguments 2215 _rr0 = rvalue_bitset<3>() 2216 , _lrc0 = lvalue_const_bitset<0>() 2217 , _lr0 = lvalue_bitset<1>() 2218 , _rrc0 = rvalue_const_bitset<2>() 2219 ); 2220 b.evaluate( // named arguments 2221 _lr0 = lvalue_bitset<1>() 2222 , _lrc0 = lvalue_const_bitset<0>() 2223 ); 2224 2225Because the parameters were wrapped in a ``(deduced …)`` clause, the following 2226function calls are also legal. 2227 2228.. parsed-literal:: 2229 2230 b.evaluate( // deduced arguments 2231 rvalue_bitset<3>() 2232 , lvalue_const_bitset<0>() 2233 , lvalue_bitset<1>() 2234 , rvalue_const_bitset<2>() 2235 ); 2236 b.evaluate( // deduced arguments 2237 lvalue_bitset<1>() 2238 , lvalue_const_bitset<0>() 2239 ); 2240 2241The |preprocessor_cpp|_ test program demonstrates proper usage of this macro. 2242 2243**Macro parameters:** 2244 2245* ``result`` is the parenthesized return type of the function. 2246* ``name`` is the base name of the function; it determines the name of the 2247 generated forwarding functions. 2248* ``tag_namespace`` is the namespace in which the keywords used by the 2249 function resides. 2250* ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of 2251 *argument-specifiers*, as defined below. 2252 2253**Argument specifiers syntax:** 2254 2255.. parsed-literal:: 2256 2257 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 2258 2259 specifier-group0 ::= *specifier-group1* | 2260 ( 2261 '**(**' '**deduced**' 2262 *specifier-group1* {*specifier-group1*\ } 2263 '**)**' 2264 ) 2265 2266 specifier-group1 ::= 2267 ( 2268 '**(**' '**optional**' 2269 *optional-specifier* {*optional-specifier*\ } 2270 '**)**' 2271 ) | ( 2272 '**(**' '**required**' 2273 *required-specifier* {*required-specifier*\ } 2274 '**)**' 2275 ) 2276 2277 optional-specifier ::= 2278 '**(**' 2279 *argument-name* '**,**' *restriction* '**,**' *default-value* 2280 ')' 2281 2282 required-specifier ::= 2283 '**(**' *argument-name* '**,**' *restriction* ')' 2284 2285 restriction ::= 2286 ( '**\***' '**(**' *mfc* '**)**' ) | 2287 ( '**(**' *type-name* '**)**' ) | 2288 '**\***' 2289 2290* ``argument-name`` is any valid C++ identifier. 2291* ``default-value`` is any valid C++ expression; if necessary, user code can 2292 compute it in terms of ``previous-name ## _type``, where ``previous-name`` 2293 is the ``argument-name`` in a previous ``specifier-group0`` or 2294 ``specifier-group1``. *This expression will be invoked exactly once.* 2295* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 2296 be the type of the corresponding ``argument-name``, whose second argument 2297 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 2298 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 2299 of ``previous-name ## _type``. 2300* ``type-name`` is either the name of a **target type** or an `MPL Binary 2301 Metafunction Class`_ whose first argument will be the type of the 2302 corresponding ``argument-name``, whose second argument will be the entire 2303 |ArgumentPack|_, and whose return type is the **target type**. If 2304 ``restriction`` uses this form, then the type of the generated name 2305 ``argument-name ## _type`` will be computed in terms of the **target 2306 type**, and the generated reference ``argument-name`` (but not its 2307 corresponding entry in ``args``) will be cast to that type. 2308 2309**Approximate expansion:** 2310 2311Where: 2312 2313* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 2314* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 2315 2316.. parsed-literal:: 2317 2318 // If **result** is a template instantiation of |boost_enable_if|_\, 2319 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 2320 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 2321 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 2322 // |std_enable_if|_\: 2323 template <typename Args> 2324 using boost_param_result_const\_ ## __LINE__ ## **name** = **result**; 2325 2326 // If **result** is a simple return type: 2327 template <typename Args> 2328 struct boost_param_result_const\_ ## __LINE__ ## **name** 2329 { 2330 typedef **result** type; 2331 }; 2332 2333 struct boost_param_params_const\_ ## __LINE__ ## **name** 2334 : |parameters|_\< 2335 *list of parameter specifications, based on arguments* 2336 > 2337 { 2338 }; 2339 2340 typedef boost_param_params_const\_ ## __LINE__ ## **name** 2341 boost_param_parameters_const\_ ## __LINE__ ## **name**; 2342 2343 template <typename A0, …, typename A ## **n**> 2344 **result** **name**\ ( 2345 A0&& a0, …, A ## **n**\ && a ## **n** 2346 , typename boost_param_parameters_const\_ ## __LINE__ ## **name** 2347 ::match<A0, …, A ## **n**>::type 2348 = boost_param_parameters_const\_ ## __LINE__ ## **name**\ () 2349 ) const 2350 { 2351 return this->boost_param_impl_const ## __LINE__ ## **name**\ ( 2352 boost_param_parameters_const\_ ## __LINE__ ## **name**\ ( 2353 |std_forward|_\<A0>(a0) 2354 , … 2355 , |std_forward|_\<A ## **n**>(a ## **n**) 2356 ) 2357 ); 2358 } 2359 2360 :vellipsis:`⋮` 2361 2362 template <typename A0, …, typename A ## **m**> 2363 **result** **name**\ ( 2364 A0&& a0, …, A ## **m**\ && a ## **m** 2365 , typename boost_param_parameters_const\_ ## __LINE__ ## **name** 2366 ::match<A0, …, A ## **m**>::type 2367 = boost_param_parameters_const\_ ## __LINE__ ## **name**\ () 2368 ) const 2369 { 2370 return this->boost_param_impl_const ## __LINE__ ## **name**\ ( 2371 boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()( 2372 |std_forward|_\<A0>(a0) 2373 , … 2374 , |std_forward|_\<A ## **m**>(a ## **m**) 2375 ) 2376 ); 2377 } 2378 2379 template <typename Args> 2380 typename boost_param_result_const\_ ## __LINE__ ## **name**\ <Args>::type 2381 boost_param_impl_const ## __LINE__ ## **name**\ (Args const& args) const 2382 { 2383 return this-> 2384 boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ ( 2385 static_cast< 2386 typename boost_param_result_const\_ ## __LINE__ ## **name**\ < 2387 Args 2388 >::type(*)() 2389 >(|std_nullptr|_\) 2390 , args 2391 , |std_forward|_\< 2392 typename |value_type|_\< 2393 Args 2394 , *keyword tag type of required parameter* ## **0** 2395 >::type 2396 >(args[ *keyword object of required parameter* ## **0**]) 2397 , … 2398 , |std_forward|_\< 2399 typename |value_type|_\< 2400 Args 2401 , *keyword tag type of required parameter* ## **n** 2402 >::type 2403 >(args[ *keyword object of required parameter* ## **n**]) 2404 ); 2405 } 2406 2407 template < 2408 typename ResultType 2409 , typename Args 2410 , typename *argument name* ## **0** ## _type 2411 , … 2412 , typename *argument name* ## **n** ## _type 2413 > 2414 ResultType 2415 boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ ( 2416 (ResultType(*)()) 2417 , Args const& args 2418 , *argument name* ## **0** ## _type&& *argument name* ## **0** 2419 , … 2420 , *argument name* ## **n** ## _type&& *argument name* ## **n** 2421 ) const 2422 { 2423 return this-> 2424 boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ ( 2425 static_cast<ResultType(*)()>(|std_nullptr|_\) 2426 , (args, *keyword object of optional parameter* ## **n + 1** = 2427 *default value of optional parameter* ## **n + 1** 2428 ) 2429 , |std_forward|_\<*argument name* ## **0** ## _type>( 2430 *argument name* ## **0** 2431 ) 2432 , … 2433 , |std_forward|_\<*argument name* ## **n** ## _type>( 2434 *argument name* ## **n** 2435 ) 2436 , |std_forward|_\< 2437 typename |value_type|_\< 2438 Args 2439 , *keyword tag type of optional parameter* ## **n + 1** 2440 >::type 2441 >(*default value of optional parameter* ## **n + 1**) 2442 ); 2443 } 2444 2445 :vellipsis:`⋮` 2446 2447 template < 2448 typename ResultType 2449 , typename Args 2450 , typename *argument name* ## **0** ## _type 2451 , … 2452 , typename *argument name* ## **m** ## _type 2453 > 2454 ResultType 2455 boost_param_dispatch_const_0boost\_ ## __LINE__ ## **name**\ ( 2456 (ResultType(*)()) 2457 , Args const& args 2458 , *argument name* ## **0** ## _type&& *argument name* ## **0** 2459 , … 2460 , *argument name* ## **m** ## _type&& *argument name* ## **m** 2461 ) const 2462 2463.. |BOOST_PARAMETER_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_FUNCTION_CALL_OPERATOR`` 2464.. _BOOST_PARAMETER_FUNCTION_CALL_OPERATOR: 2465 2466``BOOST_PARAMETER_FUNCTION_CALL_OPERATOR(result, tag_namespace, arguments)`` 2467---------------------------------------------------------------------------- 2468 2469:Defined in: |preprocessor_header|_ 2470 2471Generates a function call operator that can take in positional arguments, 2472composed arguments, named arguments, and deduced arguments. 2473 2474:Example usage: 2475 2476Define the named parameters that will comprise the argument specification that 2477this macro will use. Ensure that all their tag types are in the same 2478namespace, which is ``tag`` by default. 2479 2480.. parsed-literal:: 2481 2482 |BOOST_PARAMETER_NAME|_\(y) 2483 |BOOST_PARAMETER_NAME|_\(z) 2484 2485Use the macro as a substitute for a normal function call operator 2486header. Enclose the return type in parentheses. For each parameter, also 2487enclose the expected value type in parentheses. Since the value types are 2488mutually exclusive, you can wrap the parameters in a ``(deduced …)`` 2489clause. This is especially useful when implementing multiple 2490Boost.Parameter-enabled function call operator overloads. 2491 2492.. parsed-literal:: 2493 2494 class char_reader 2495 { 2496 int index; 2497 char const* key; 2498 2499 public: 2500 explicit char_reader(char const* k) : index(0), key(k) 2501 { 2502 } 2503 2504 BOOST_PARAMETER_FUNCTION_CALL_OPERATOR((void), tag, 2505 (deduced 2506 (required 2507 (y, (int)) 2508 (z, (char const*)) 2509 ) 2510 ) 2511 ) 2512 { 2513 this->index = y; 2514 this->key = z; 2515 } 2516 2517 |BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR|_\((char), tag, 2518 (deduced 2519 (required 2520 (y, (bool)) 2521 (z, (|std_map|_\<char const*, |std_string|_\>)) 2522 ) 2523 ) 2524 ) 2525 { 2526 return y ? ( 2527 (z.find(this->key)->second)[this->index] 2528 ) : this->key[this->index]; 2529 } 2530 }; 2531 2532As with regular argument-dependent lookup, the value types of the arguments 2533passed in determine which function call operator overload gets invoked. 2534 2535.. parsed-literal:: 2536 2537 char const* keys[] = {"foo", "bar", "baz"}; 2538 |std_map|_\<char const*, |std_string|_\> k2s; 2539 k2s[keys[0]] = |std_string|_\("qux"); 2540 k2s[keys[1]] = |std_string|_\("wmb"); 2541 k2s[keys[2]] = |std_string|_\("zxc"); 2542 char_reader r(keys[0]); 2543 2544 // positional arguments 2545 BOOST_TEST_EQ('q', (r(true, k2s))); 2546 BOOST_TEST_EQ('f', (r(false, k2s))); 2547 2548 // named arguments 2549 r(_z = keys[1], _y = 1); 2550 BOOST_TEST_EQ('m', (r(_z = k2s, _y = true))); 2551 BOOST_TEST_EQ('a', (r(_z = k2s, _y = false))); 2552 2553 // deduced arguments 2554 r(keys[2], 2); 2555 BOOST_TEST_EQ('c', (r(k2s, true))); 2556 BOOST_TEST_EQ('z', (r(k2s, false))); 2557 2558The |preprocessor_cpp|_ and |preprocessor_deduced_cpp|_ test programs 2559demonstrate proper usage of this macro. 2560 2561**Macro parameters:** 2562 2563* ``result`` is the parenthesized return type of the function call operator. 2564* ``tag_namespace`` is the namespace in which the keywords used by the 2565 function call operator resides. 2566* ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of 2567 *argument-specifiers*, as defined below. 2568 2569**Argument specifiers syntax:** 2570 2571.. parsed-literal:: 2572 2573 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 2574 2575 specifier-group0 ::= *specifier-group1* | 2576 ( 2577 '**(**' '**deduced**' 2578 *specifier-group1* {*specifier-group1*\ } 2579 '**)**' 2580 ) 2581 2582 specifier-group1 ::= 2583 ( 2584 '**(**' '**optional**' 2585 *optional-specifier* {*optional-specifier*\ } 2586 '**)**' 2587 ) | ( 2588 '**(**' '**required**' 2589 *required-specifier* {*required-specifier*\ } 2590 '**)**' 2591 ) 2592 2593 optional-specifier ::= 2594 '**(**' 2595 *argument-name* '**,**' *restriction* '**,**' *default-value* 2596 ')' 2597 2598 required-specifier ::= 2599 '**(**' *argument-name* '**,**' *restriction* ')' 2600 2601 restriction ::= 2602 ( '**\***' '**(**' *mfc* '**)**' ) | 2603 ( '**(**' *type-name* '**)**' ) | 2604 '**\***' 2605 2606* ``argument-name`` is any valid C++ identifier. 2607* ``default-value`` is any valid C++ expression; if necessary, user code can 2608 compute it in terms of ``previous-name ## _type``, where ``previous-name`` 2609 is the ``argument-name`` in a previous ``specifier-group0`` or 2610 ``specifier-group1``. *This expression will be invoked exactly once.* 2611* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 2612 be the type of the corresponding ``argument-name``, whose second argument 2613 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 2614 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 2615 of ``previous-name ## _type``. 2616* ``type-name`` is either the name of a **target type** or an `MPL Binary 2617 Metafunction Class`_ whose first argument will be the type of the 2618 corresponding ``argument-name``, whose second argument will be the entire 2619 |ArgumentPack|_, and whose return type is the **target type**. If 2620 ``restriction`` uses this form, then the type of the generated name 2621 ``argument-name ## _type`` will be computed in terms of the **target 2622 type**, and the generated reference ``argument-name`` (but not its 2623 corresponding entry in ``args``) will be cast to that type. 2624 2625**Approximate expansion:** 2626 2627Where: 2628 2629* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 2630* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 2631 2632.. parsed-literal:: 2633 2634 // If **result** is a template instantiation of |boost_enable_if|_\, 2635 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 2636 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 2637 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 2638 // |std_enable_if|_\: 2639 template <typename Args> 2640 using boost_param_result\_ ## __LINE__ ## operator = **result**; 2641 2642 // If **result** is a simple return type: 2643 template <typename Args> 2644 struct boost_param_result\_ ## __LINE__ ## operator 2645 { 2646 typedef **result** type; 2647 }; 2648 2649 struct boost_param_params\_ ## __LINE__ ## operator 2650 : |parameters|_\< 2651 *list of parameter specifications, based on arguments* 2652 > 2653 { 2654 }; 2655 2656 typedef boost_param_params\_ ## __LINE__ ## operator 2657 boost_param_parameters\_ ## __LINE__ ## operator; 2658 2659 template <typename A0, …, typename A ## **n**> 2660 **result** operator()( 2661 A0&& a0, …, A ## **n**\ && a ## **n** 2662 , typename boost_param_parameters\_ ## __LINE__ ## operator::match< 2663 A0, …, A ## **n** 2664 >::type = boost_param_parameters\_ ## __LINE__ ## operator() 2665 ) 2666 { 2667 return this->boost_param_impl ## __LINE__ ## operator( 2668 boost_param_parameters\_ ## __LINE__ ## operator()( 2669 |std_forward|_\<A0>(a0) 2670 , … 2671 , |std_forward|_\<A ## **n**>(a ## **n**) 2672 ) 2673 ); 2674 } 2675 2676 :vellipsis:`⋮` 2677 2678 template <typename A0, …, typename A ## **m**> 2679 **result** operator()( 2680 A0&& a0, …, A ## **m**\ && a ## **m** 2681 , typename boost_param_parameters\_ ## __LINE__ ## operator::match< 2682 A0, …, A ## **m** 2683 >::type = boost_param_parameters\_ ## __LINE__ ## operator() 2684 ) 2685 { 2686 return this->boost_param_impl ## __LINE__ ## operator( 2687 boost_param_parameters\_ ## __LINE__ ## operator()( 2688 |std_forward|_\<A0>(a0) 2689 , … 2690 , |std_forward|_\<A ## **m**>(a ## **m**) 2691 ) 2692 ); 2693 } 2694 2695 template <typename Args> 2696 typename boost_param_result\_ ## __LINE__ ## operator<Args>::type 2697 boost_param_impl ## __LINE__ ## operator(Args const& args) 2698 { 2699 return this->boost_param_dispatch_0boost\_ ## __LINE__ ## operator( 2700 static_cast< 2701 typename boost_param_result\_ ## __LINE__ ## operator< 2702 Args 2703 >::type(*)() 2704 >(|std_nullptr|_\) 2705 , args 2706 , |std_forward|_\< 2707 typename |value_type|_\< 2708 Args 2709 , *keyword tag type of required parameter* ## **0** 2710 >::type 2711 >(args[ *keyword object of required parameter* ## **0**]) 2712 , … 2713 , |std_forward|_\< 2714 typename |value_type|_\< 2715 Args 2716 , *keyword tag type of required parameter* ## **n** 2717 >::type 2718 >(args[ *keyword object of required parameter* ## **n**]) 2719 ); 2720 } 2721 2722 template < 2723 typename ResultType 2724 , typename Args 2725 , typename *argument name* ## **0** ## _type 2726 , … 2727 , typename *argument name* ## **n** ## _type 2728 > 2729 ResultType 2730 boost_param_dispatch_0boost\_ ## __LINE__ ## operator( 2731 (ResultType(*)()) 2732 , Args const& args 2733 , *argument name* ## **0** ## _type&& *argument name* ## **0** 2734 , … 2735 , *argument name* ## **n** ## _type&& *argument name* ## **n** 2736 ) 2737 { 2738 return this->boost_param_dispatch_0boost\_ ## __LINE__ ## operator( 2739 static_cast<ResultType(*)()>(|std_nullptr|_\) 2740 , (args, *keyword object of optional parameter* ## **n + 1** = 2741 *default value of optional parameter* ## **n + 1** 2742 ) 2743 , |std_forward|_\<*argument name* ## **0** ## _type>( 2744 *argument name* ## **0** 2745 ) 2746 , … 2747 , |std_forward|_\<*argument name* ## **n** ## _type>( 2748 *argument name* ## **n** 2749 ) 2750 , |std_forward|_\< 2751 typename |value_type|_\< 2752 Args 2753 , *keyword tag type of optional parameter* ## **n + 1** 2754 >::type 2755 >(*default value of optional parameter* ## **n + 1**) 2756 ); 2757 } 2758 2759 :vellipsis:`⋮` 2760 2761 template < 2762 typename ResultType 2763 , typename Args 2764 , typename *argument name* ## **0** ## _type 2765 , … 2766 , typename *argument name* ## **m** ## _type 2767 > 2768 ResultType 2769 boost_param_dispatch_0boost\_ ## __LINE__ ## operator( 2770 (ResultType(*)()) 2771 , Args const& args 2772 , *argument name* ## **0** ## _type&& *argument name* ## **0** 2773 , … 2774 , *argument name* ## **m** ## _type&& *argument name* ## **m** 2775 ) 2776 2777.. |BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR`` 2778.. _BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR: 2779 2780``BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)`` 2781--------------------------------------------------------------------------- 2782 2783:Defined in: |preprocessor_header|_ 2784 2785Generates a function call operator that can take in positional arguments, 2786composed arguments, named arguments, and deduced arguments. 2787 2788:Example usage: 2789 2790The return type of each of the following function templates falls under a 2791different value category. 2792 2793.. parsed-literal:: 2794 2795 template <std::size_t N> 2796 |std_bitset|_\<N + 1> rvalue_bitset() 2797 { 2798 return |std_bitset|_\<N + 1>(); 2799 } 2800 2801 template <std::size_t N> 2802 |std_bitset|_\<N + 1> const rvalue_const_bitset() 2803 { 2804 return |std_bitset|_\<N + 1>(); 2805 } 2806 2807 template <std::size_t N> 2808 |std_bitset|_\<N + 1>& lvalue_bitset() 2809 { 2810 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 2811 return lset; 2812 } 2813 2814 template <std::size_t N> 2815 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 2816 { 2817 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 2818 return clset; 2819 } 2820 2821The ``U::evaluate_category`` static member function template has a simple job: 2822to return the correct value category when passed in an object returned by one 2823of the functions defined above. Assume that 2824|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 2825 2826.. parsed-literal:: 2827 2828 enum invoked 2829 { 2830 passed_by_lvalue_reference_to_const 2831 , passed_by_lvalue_reference 2832 , passed_by_rvalue_reference_to_const 2833 , passed_by_rvalue_reference 2834 }; 2835 2836 struct U 2837 { 2838 template <std::size_t N> 2839 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 2840 { 2841 return passed_by_lvalue_reference_to_const; 2842 } 2843 2844 template <std::size_t N> 2845 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 2846 { 2847 return passed_by_lvalue_reference; 2848 } 2849 2850 template <std::size_t N> 2851 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 2852 { 2853 return passed_by_rvalue_reference_to_const; 2854 } 2855 2856 template <std::size_t N> 2857 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 2858 { 2859 return passed_by_rvalue_reference; 2860 } 2861 }; 2862 2863Define the named parameters that will comprise the argument specification that 2864this macro will use. Ensure that all their tag types are in the same 2865namespace, which is ``kw`` in this case. The identifiers with leading 2866underscores can be passed to the bracket operator of ``args`` to extract the 2867same argument to which the corresponding named parameter (without underscores) 2868is bound, as will be shown later. 2869 2870.. parsed-literal:: 2871 2872 |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc)) 2873 |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr)) 2874 |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc)) 2875 |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr)) 2876 2877Use the macro as a substitute for a normal ``const`` function call operator 2878header. Enclose the return type ``bool`` in parentheses. For each parameter, 2879also enclose the expected value type in parentheses. Since the value types 2880are mutually exclusive, you can wrap the parameters in a ``(deduced …)`` 2881clause. Otherwise, just as with a normal function, the order in which you 2882specify the parameters determines their position. Also, just as with a normal 2883function, optional parameters have default values, whereas required parameters 2884do not. Within the function body, either simply use the parameter name or 2885pass the matching identifier with the leading underscore to the bracket 2886operator of ``args`` to extract the corresponding argument. Note that the 2887second method doesn't require ``std::forward`` to preserve value categories. 2888 2889.. parsed-literal:: 2890 2891 struct B 2892 { 2893 B() 2894 { 2895 } 2896 2897 BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR((bool), kw, 2898 (deduced 2899 (required 2900 (lrc, (|std_bitset|_\<1>)) 2901 (lr, (|std_bitset|_\<2>)) 2902 ) 2903 (optional 2904 (rrc, (|std_bitset|_\<3>), rvalue_const_bitset<2>()) 2905 (rr, (|std_bitset|_\<4>), rvalue_bitset<3>()) 2906 ) 2907 ) 2908 ) 2909 { 2910 BOOST_TEST_EQ( 2911 passed_by_lvalue_reference_to_const 2912 , U::evaluate_category<0>(lrc) 2913 ); 2914 BOOST_TEST_EQ( 2915 passed_by_lvalue_reference 2916 , U::evaluate_category<1>(lr) 2917 ); 2918 BOOST_TEST_EQ( 2919 passed_by_rvalue_reference_to_const 2920 , U::evaluate_category<2>(|std_forward|_\<rrc0_type>(rrc0)) 2921 ); 2922 BOOST_TEST_EQ( 2923 passed_by_rvalue_reference 2924 , U::evaluate_category<3>(args[_rr0]) 2925 ); 2926 2927 return true; 2928 } 2929 }; 2930 2931The following function calls are legal. 2932 2933.. parsed-literal:: 2934 2935 B const b = B(); 2936 b( // positional arguments 2937 lvalue_const_bitset<0>() 2938 , lvalue_bitset<1>() 2939 , rvalue_const_bitset<2>() 2940 , rvalue_bitset<3>() 2941 ); 2942 b( // positional arguments 2943 lvalue_const_bitset<0>() 2944 , lvalue_bitset<1>() 2945 ); 2946 b(( // composed arguments 2947 _rr0 = rvalue_bitset<3>() 2948 , _lrc0 = lvalue_const_bitset<0>() 2949 , _lr0 = lvalue_bitset<1>() 2950 , _rrc0 = rvalue_const_bitset<2>() 2951 )); 2952 b( // named arguments 2953 _rr0 = rvalue_bitset<3>() 2954 , _lrc0 = lvalue_const_bitset<0>() 2955 , _lr0 = lvalue_bitset<1>() 2956 , _rrc0 = rvalue_const_bitset<2>() 2957 ); 2958 b( // named arguments 2959 _lr0 = lvalue_bitset<1>() 2960 , _lrc0 = lvalue_const_bitset<0>() 2961 ); 2962 2963Because the parameters were wrapped in a ``(deduced …)`` clause, the following 2964function calls are also legal. 2965 2966.. parsed-literal:: 2967 2968 b( // deduced arguments 2969 rvalue_bitset<3>() 2970 , lvalue_const_bitset<0>() 2971 , lvalue_bitset<1>() 2972 , rvalue_const_bitset<2>() 2973 ); 2974 b( // deduced arguments 2975 lvalue_bitset<1>() 2976 , lvalue_const_bitset<0>() 2977 ); 2978 2979The |preprocessor_cpp|_, |preprocessor_deduced_cpp|_, and 2980|preprocessor_eval_cat_8_cpp|_ test programs demonstrate proper usage of this 2981macro. 2982 2983**Macro parameters:** 2984 2985* ``result`` is the parenthesized return type of the function call operator. 2986* ``tag_namespace`` is the namespace in which the keywords used by the 2987 function call operator resides. 2988* ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of 2989 *argument-specifiers*, as defined below. 2990 2991**Argument specifiers syntax:** 2992 2993.. parsed-literal:: 2994 2995 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 2996 2997 specifier-group0 ::= *specifier-group1* | 2998 ( 2999 '**(**' '**deduced**' 3000 *specifier-group1* {*specifier-group1*\ } 3001 '**)**' 3002 ) 3003 3004 specifier-group1 ::= 3005 ( 3006 '**(**' '**optional**' 3007 *optional-specifier* {*optional-specifier*\ } 3008 '**)**' 3009 ) | ( 3010 '**(**' '**required**' 3011 *required-specifier* {*required-specifier*\ } 3012 '**)**' 3013 ) 3014 3015 optional-specifier ::= 3016 '**(**' 3017 *argument-name* '**,**' *restriction* '**,**' *default-value* 3018 ')' 3019 3020 required-specifier ::= 3021 '**(**' *argument-name* '**,**' *restriction* ')' 3022 3023 restriction ::= 3024 ( '**\***' '**(**' *mfc* '**)**' ) | 3025 ( '**(**' *type-name* '**)**' ) | 3026 '**\***' 3027 3028* ``argument-name`` is any valid C++ identifier. 3029* ``default-value`` is any valid C++ expression; if necessary, user code can 3030 compute it in terms of ``previous-name ## _type``, where ``previous-name`` 3031 is the ``argument-name`` in a previous ``specifier-group0`` or 3032 ``specifier-group1``. *This expression will be invoked exactly once.* 3033* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 3034 be the type of the corresponding ``argument-name``, whose second argument 3035 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 3036 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 3037 of ``previous-name ## _type``. 3038* ``type-name`` is either the name of a **target type** or an `MPL Binary 3039 Metafunction Class`_ whose first argument will be the type of the 3040 corresponding ``argument-name``, whose second argument will be the entire 3041 |ArgumentPack|_, and whose return type is the **target type**. If 3042 ``restriction`` uses this form, then the type of the generated name 3043 ``argument-name ## _type`` will be computed in terms of the **target 3044 type**, and the generated reference ``argument-name`` (but not its 3045 corresponding entry in ``args``) will be cast to that type. 3046 3047**Approximate expansion:** 3048 3049Where: 3050 3051* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 3052* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 3053 3054.. parsed-literal:: 3055 3056 // If **result** is a template instantiation of |boost_enable_if|_\, 3057 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 3058 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 3059 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 3060 // |std_enable_if|_\: 3061 template <typename Args> 3062 using boost_param_result_const\_ ## __LINE__ ## operator = **result**; 3063 3064 // If **result** is a simple return type: 3065 template <typename Args> 3066 struct boost_param_result_const\_ ## __LINE__ ## operator 3067 { 3068 typedef **result** type; 3069 }; 3070 3071 struct boost_param_params_const\_ ## __LINE__ ## operator 3072 : |parameters|_\< 3073 *list of parameter specifications, based on arguments* 3074 > 3075 { 3076 }; 3077 3078 typedef boost_param_params_const\_ ## __LINE__ ## operator 3079 boost_param_parameters_const\_ ## __LINE__ ## operator; 3080 3081 template <typename A0, …, typename A ## **n**> 3082 **result** operator()( 3083 A0&& a0, …, A ## **n**\ && a ## **n** 3084 , typename boost_param_parameters_const\_ ## __LINE__ ## operator 3085 ::match<A0, …, A ## **n**>::type 3086 = boost_param_parameters_const\_ ## __LINE__ ## operator() 3087 ) const 3088 { 3089 return this->boost_param_impl_const ## __LINE__ ## operator( 3090 boost_param_parameters_const\_ ## __LINE__ ## operator()( 3091 |std_forward|_\<A0>(a0) 3092 , … 3093 , |std_forward|_\<A ## **n**>(a ## **n**) 3094 ) 3095 ); 3096 } 3097 3098 :vellipsis:`⋮` 3099 3100 template <typename A0, …, typename A ## **m**> 3101 **result** operator()( 3102 A0&& a0, …, A ## **m**\ && a ## **m** 3103 , typename boost_param_parameters_const\_ ## __LINE__ ## operator 3104 ::match<A0, …, A ## **m**>::type 3105 = boost_param_parameters_const\_ ## __LINE__ ## operator() 3106 ) const 3107 { 3108 return this->boost_param_impl_const ## __LINE__ ## operator( 3109 boost_param_parameters_const\_ ## __LINE__ ## operator()( 3110 |std_forward|_\<A0>(a0) 3111 , … 3112 , |std_forward|_\<A ## **m**>(a ## **m**) 3113 ) 3114 ); 3115 } 3116 3117 template <typename Args> 3118 typename boost_param_result_const\_ ## __LINE__ ## operator<Args>::type 3119 boost_param_impl_const ## __LINE__ ## operator(Args const& args) const 3120 { 3121 return this-> 3122 boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator( 3123 static_cast< 3124 typename boost_param_result_const\_ ## __LINE__ ## operator< 3125 Args 3126 >::type(*)() 3127 >(|std_nullptr|_\) 3128 , args 3129 , |std_forward|_\< 3130 typename |value_type|_\< 3131 Args 3132 , *keyword tag type of required parameter* ## **0** 3133 >::type 3134 >(args[ *keyword object of required parameter* ## **0**]) 3135 , … 3136 , |std_forward|_\< 3137 typename |value_type|_\< 3138 Args 3139 , *keyword tag type of required parameter* ## **n** 3140 >::type 3141 >(args[ *keyword object of required parameter* ## **n**]) 3142 ); 3143 } 3144 3145 template < 3146 typename ResultType 3147 , typename Args 3148 , typename *argument name* ## **0** ## _type 3149 , … 3150 , typename *argument name* ## **n** ## _type 3151 > 3152 ResultType 3153 boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator( 3154 (ResultType(*)()) 3155 , Args const& args 3156 , *argument name* ## **0** ## _type&& *argument name* ## **0** 3157 , … 3158 , *argument name* ## **n** ## _type&& *argument name* ## **n** 3159 ) const 3160 { 3161 return this-> 3162 boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator( 3163 static_cast<ResultType(*)()>(|std_nullptr|_\) 3164 , (args, *keyword object of optional parameter* ## **n + 1** = 3165 *default value of optional parameter* ## **n + 1** 3166 ) 3167 , |std_forward|_\<*argument name* ## **0** ## _type>( 3168 *argument name* ## **0** 3169 ) 3170 , … 3171 , |std_forward|_\<*argument name* ## **n** ## _type>( 3172 *argument name* ## **n** 3173 ) 3174 , |std_forward|_\< 3175 typename |value_type|_\< 3176 Args 3177 , *keyword tag type of optional parameter* ## **n + 1** 3178 >::type 3179 >(*default value of optional parameter* ## **n + 1**) 3180 ); 3181 } 3182 3183 :vellipsis:`⋮` 3184 3185 template < 3186 typename ResultType 3187 , typename Args 3188 , typename *argument name* ## **0** ## _type 3189 , … 3190 , typename *argument name* ## **m** ## _type 3191 > 3192 ResultType 3193 boost_param_dispatch_const_0boost\_ ## __LINE__ ## operator( 3194 (ResultType(*)()) 3195 , Args const& args 3196 , *argument name* ## **0** ## _type&& *argument name* ## **0** 3197 , … 3198 , *argument name* ## **m** ## _type&& *argument name* ## **m** 3199 ) const 3200 3201.. |BOOST_PARAMETER_CONSTRUCTOR| replace:: ``BOOST_PARAMETER_CONSTRUCTOR`` 3202.. _BOOST_PARAMETER_CONSTRUCTOR: 3203 3204``BOOST_PARAMETER_CONSTRUCTOR(cls, impl, tag_namespace, arguments)`` 3205-------------------------------------------------------------------- 3206 3207:Defined in: |preprocessor_header|_ 3208 3209Generates a constructor that can take in positional arguments, composed 3210arguments, named arguments, and deduced arguments. 3211 3212:Example usage: 3213 3214Define the named parameters that will comprise the argument specification that 3215this macro will use. Ensure that all their tag types are in the same 3216namespace, which is ``tag`` by default. 3217 3218.. parsed-literal:: 3219 3220 |BOOST_PARAMETER_NAME|_\(y) 3221 |BOOST_PARAMETER_NAME|_\(z) 3222 3223In the base class, implement a delegate constructor template that takes in an 3224|ArgumentPack|_. You must pass the identifiers with leading underscores to 3225``args`` in order to extract the corresponding arguments. 3226 3227.. parsed-literal:: 3228 3229 class char_read_base 3230 { 3231 int index; 3232 char const* key; 3233 3234 public: 3235 template <typename Args> 3236 explicit char_read_base(Args const& args) 3237 : index(args[_y]), key(args[_z]) 3238 { 3239 } 3240 3241 |BOOST_PARAMETER_CONST_FUNCTION_CALL_OPERATOR|_\((char), tag, 3242 (deduced 3243 (required 3244 (y, (bool)) 3245 (z, (|std_map|_\<char const*, |std_string|_\>)) 3246 ) 3247 ) 3248 ) 3249 { 3250 return y ? ( 3251 (z.find(this->key)->second)[this->index] 3252 ) : this->key[this->index]; 3253 } 3254 }; 3255 3256Use the macro as a substitute for a normal constructor definition. Note the 3257lack of an explicit body. Enclose the base type in parentheses. For each 3258parameter, also enclose the expected value type in parentheses. Since the 3259value types are mutually exclusive, you can wrap the parameters in a 3260``(deduced …)`` clause. 3261 3262.. parsed-literal:: 3263 3264 struct char_reader : public char_read_base 3265 { 3266 BOOST_PARAMETER_CONSTRUCTOR(char_reader, (char_read_base), tag, 3267 (deduced 3268 (required 3269 (y, (int)) 3270 (z, (char const*)) 3271 ) 3272 ) 3273 ) 3274 }; 3275 3276The following ``char_reader`` constructor calls are legal. 3277 3278.. parsed-literal:: 3279 3280 char const* keys[] = {"foo", "bar", "baz"}; 3281 |std_map|_\<char const*, |std_string|_\> k2s; 3282 k2s[keys[0]] = |std_string|_\("qux"); 3283 k2s[keys[1]] = |std_string|_\("wmb"); 3284 k2s[keys[2]] = |std_string|_\("zxc"); 3285 3286 // positional arguments 3287 char_reader r0(0, keys[0]); 3288 BOOST_TEST_EQ('q', (r0(true, k2s))); 3289 BOOST_TEST_EQ('f', (r0(false, k2s))); 3290 3291 // named arguments 3292 char_reader r1(_z = keys[1], _y = 1); 3293 BOOST_TEST_EQ('m', (r1(_z = k2s, _y = true))); 3294 BOOST_TEST_EQ('a', (r1(_z = k2s, _y = false))); 3295 3296 // deduced arguments 3297 char_reader r2(keys[2], 2); 3298 BOOST_TEST_EQ('c', (r2(k2s, true))); 3299 BOOST_TEST_EQ('z', (r2(k2s, false))); 3300 3301The |preprocessor_cpp|_ and |preprocessor_deduced_cpp|_ test programs 3302demonstrate proper usage of this macro. 3303 3304**Macro parameters:** 3305 3306* ``cls`` is the name of the enclosing class. 3307* ``impl`` is the parenthesized implementation base class for ``cls``. 3308* ``tag_namespace`` is the namespace in which the keywords used by the 3309 constructor resides. 3310* ``arguments`` is a list of *argument-specifiers*, as defined below. 3311 3312**Argument specifiers syntax:** 3313 3314.. parsed-literal:: 3315 3316 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 3317 3318 specifier-group0 ::= *specifier-group1* | 3319 ( 3320 '**(**' '**deduced**' 3321 *specifier-group1* {*specifier-group1*\ } 3322 '**)**' 3323 ) 3324 3325 specifier-group1 ::= 3326 ( 3327 '**(**' '**optional**' 3328 *specifier* {*specifier*\ } 3329 '**)**' 3330 ) | ( 3331 '**(**' '**required**' 3332 *specifier* {*specifier*\ } 3333 '**)**' 3334 ) 3335 3336 specifier ::= 3337 '**(**' *argument-name* '**,**' *restriction* ')' 3338 3339 restriction ::= 3340 ( '**\***' '**(**' *mfc* '**)**' ) | 3341 ( '**(**' *type-name* '**)**' ) | 3342 '**\***' 3343 3344* ``argument-name`` is any valid C++ identifier. 3345* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 3346 be the type of the corresponding ``argument-name``, whose second argument 3347 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 3348 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 3349 of ``previous-name ## _type``. 3350* ``type-name`` is either the name of a **target type** or an `MPL Binary 3351 Metafunction Class`_ whose first argument will be the type of the 3352 corresponding ``argument-name``, whose second argument will be the entire 3353 |ArgumentPack|_, and whose return type is the **target type**. 3354 3355Note that *specifier* does not include *default-value*. It is up to the 3356delegate constructor in ``impl`` to determine the default value of all 3357optional arguments. 3358 3359**Approximate expansion:** 3360 3361Where: 3362 3363* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 3364* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 3365 3366.. parsed-literal:: 3367 3368 struct boost_param_params\_ ## __LINE__ ## ctor 3369 : |parameters|_\< 3370 *list of parameter specifications, based on arguments* 3371 > 3372 { 3373 }; 3374 3375 typedef boost_param_params\_ ## __LINE__ ## ctor 3376 constructor_parameters ## __LINE__; 3377 3378 template <typename A0, …, typename A ## **n**> 3379 **cls**\ (A0&& a0, …, A ## **n** && a ## **n**) 3380 : **impl**\ ( 3381 constructor_parameters ## __LINE__( 3382 |std_forward|_\<A0>(a0) 3383 , … 3384 , |std_forward|_\<A ## **n**>(a ## **n**) 3385 ) 3386 ) 3387 { 3388 } 3389 3390 :vellipsis:`⋮` 3391 3392 template <typename A0, …, typename A ## **m**> 3393 **cls**\ (A0&& a0, …, A ## **m** && a ## **m**) 3394 : **impl**\ ( 3395 constructor_parameters ## __LINE__( 3396 |std_forward|_\<A0>(a0) 3397 , … 3398 , |std_forward|_\<A ## **m**>(a ## **m**) 3399 ) 3400 ) 3401 { 3402 } 3403 3404.. |BOOST_PARAMETER_BASIC_FUNCTION| replace:: ``BOOST_PARAMETER_BASIC_FUNCTION`` 3405.. _BOOST_PARAMETER_BASIC_FUNCTION: 3406 3407``BOOST_PARAMETER_BASIC_FUNCTION(result, name, tag_namespace, arguments)`` 3408-------------------------------------------------------------------------- 3409 3410:Defined in: |preprocessor_header|_ 3411 3412Generates a function that can take in positional arguments, composed 3413arguments, named arguments, and deduced arguments. 3414 3415:Example usage: 3416 3417The return type of each of the following function templates falls under a 3418different value category. 3419 3420.. parsed-literal:: 3421 3422 template <std::size_t N> 3423 |std_bitset|_\<N + 1> rvalue_bitset() 3424 { 3425 return |std_bitset|_\<N + 1>(); 3426 } 3427 3428 template <std::size_t N> 3429 |std_bitset|_\<N + 1> const rvalue_const_bitset() 3430 { 3431 return |std_bitset|_\<N + 1>(); 3432 } 3433 3434 template <std::size_t N> 3435 |std_bitset|_\<N + 1>& lvalue_bitset() 3436 { 3437 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 3438 return lset; 3439 } 3440 3441 template <std::size_t N> 3442 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 3443 { 3444 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 3445 return clset; 3446 } 3447 3448The ``U::evaluate_category`` static member function template has a simple job: 3449to return the correct value category when passed in an object returned by one 3450of the functions defined above. Assume that 3451|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 3452 3453.. parsed-literal:: 3454 3455 enum invoked 3456 { 3457 passed_by_lvalue_reference_to_const 3458 , passed_by_lvalue_reference 3459 , passed_by_rvalue_reference_to_const 3460 , passed_by_rvalue_reference 3461 }; 3462 3463 struct U 3464 { 3465 template <std::size_t N> 3466 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 3467 { 3468 return passed_by_lvalue_reference_to_const; 3469 } 3470 3471 template <std::size_t N> 3472 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 3473 { 3474 return passed_by_lvalue_reference; 3475 } 3476 3477 template <std::size_t N> 3478 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 3479 { 3480 return passed_by_rvalue_reference_to_const; 3481 } 3482 3483 template <std::size_t N> 3484 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 3485 { 3486 return passed_by_rvalue_reference; 3487 } 3488 }; 3489 3490Define the named parameters that will comprise the argument specification that 3491this macro will use. Ensure that all their tag types are in the same 3492namespace, which is ``kw`` in this case. The identifiers with leading 3493underscores can be passed to the bracket operator of ``args`` to extract the 3494same argument to which the corresponding named parameter (without underscores) 3495is bound, as will be shown later. 3496 3497.. parsed-literal:: 3498 3499 |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc)) 3500 |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr)) 3501 |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc)) 3502 |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr)) 3503 3504Use the macro as a substitute for a normal function header. Enclose the 3505return type ``bool`` in parentheses. For each parameter, also enclose the 3506expected value type in parentheses. Since the value types are mutually 3507exclusive, you can wrap the parameters in a ``(deduced …)`` 3508clause. Otherwise, just as with a normal function, the order in which you 3509specify the parameters determines their position. However, unlike a normal 3510function, default values must be specified within the function body. Also 3511within the function body, you must pass the matching identifier with the 3512leading underscore to the bracket operator of ``args`` to extract the 3513corresponding argument, but at least this doesn't require ``std::forward`` to 3514preserve value categories. 3515 3516.. parsed-literal:: 3517 3518 BOOST_PARAMETER_BASIC_FUNCTION((bool), evaluate, kw, 3519 (deduced 3520 (required 3521 (lrc, (|std_bitset|_\<1>)) 3522 (lr, (|std_bitset|_\<2>)) 3523 ) 3524 (optional 3525 (rrc, (|std_bitset|_\<3>)) 3526 (rr, (|std_bitset|_\<4>)) 3527 ) 3528 ) 3529 ) 3530 { 3531 BOOST_TEST_EQ( 3532 passed_by_lvalue_reference_to_const 3533 , U::evaluate_category<0>(args[_lrc]) 3534 ); 3535 BOOST_TEST_EQ( 3536 passed_by_lvalue_reference 3537 , U::evaluate_category<1>(args[_lr]) 3538 ); 3539 BOOST_TEST_EQ( 3540 passed_by_rvalue_reference_to_const 3541 , U::evaluate_category<2>( 3542 args[_rrc0 | rvalue_const_bitset<2>()] 3543 ) 3544 ); 3545 BOOST_TEST_EQ( 3546 passed_by_rvalue_reference 3547 , U::evaluate_category<3>(args[_rr0 | rvalue_bitset<3>()]) 3548 ); 3549 3550 return true; 3551 } 3552 3553The following function calls are legal. 3554 3555.. parsed-literal:: 3556 3557 evaluate( // positional arguments 3558 lvalue_const_bitset<0>() 3559 , lvalue_bitset<1>() 3560 , rvalue_const_bitset<2>() 3561 , rvalue_bitset<3>() 3562 ); 3563 evaluate( // positional arguments 3564 lvalue_const_bitset<0>() 3565 , lvalue_bitset<1>() 3566 ); 3567 evaluate(( // composed arguments 3568 _rr0 = rvalue_bitset<3>() 3569 , _lrc0 = lvalue_const_bitset<0>() 3570 , _lr0 = lvalue_bitset<1>() 3571 , _rrc0 = rvalue_const_bitset<2>() 3572 )); 3573 evaluate( // named arguments 3574 _rr0 = rvalue_bitset<3>() 3575 , _lrc0 = lvalue_const_bitset<0>() 3576 , _lr0 = lvalue_bitset<1>() 3577 , _rrc0 = rvalue_const_bitset<2>() 3578 ); 3579 evaluate( // named arguments 3580 _lr0 = lvalue_bitset<1>() 3581 , _lrc0 = lvalue_const_bitset<0>() 3582 ); 3583 3584Because the parameters were wrapped in a ``(deduced …)`` clause, the following 3585function calls are also legal. 3586 3587.. parsed-literal:: 3588 3589 evaluate( // deduced arguments 3590 rvalue_bitset<3>() 3591 , lvalue_const_bitset<0>() 3592 , lvalue_bitset<1>() 3593 , rvalue_const_bitset<2>() 3594 ); 3595 evaluate( // deduced arguments 3596 lvalue_bitset<1>() 3597 , lvalue_const_bitset<0>() 3598 ); 3599 3600The |preprocessor_cpp|_ test program demonstrates proper usage of this macro. 3601 3602**Macro parameters:** 3603 3604* ``result`` is the parenthesized return type of the function. 3605* ``name`` is the base name of the function; it determines the name of the 3606 generated forwarding functions. 3607* ``tag_namespace`` is the namespace in which the keywords used by the 3608 function resides. 3609* ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of 3610 *argument-specifiers*, as defined below. 3611 3612**Argument specifiers syntax:** 3613 3614.. parsed-literal:: 3615 3616 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 3617 3618 specifier-group0 ::= *specifier-group1* | 3619 ( 3620 '**(**' '**deduced**' 3621 *specifier-group1* {*specifier-group1*\ } 3622 '**)**' 3623 ) 3624 3625 specifier-group1 ::= 3626 ( 3627 '**(**' '**optional**' 3628 *specifier* {*specifier*\ } 3629 '**)**' 3630 ) | ( 3631 '**(**' '**required**' 3632 *specifier* {*specifier*\ } 3633 '**)**' 3634 ) 3635 3636 specifier ::= 3637 '**(**' *argument-name* '**,**' *restriction* ')' 3638 3639 restriction ::= 3640 ( '**\***' '**(**' *mfc* '**)**' ) | 3641 ( '**(**' *type-name* '**)**' ) | 3642 '**\***' 3643 3644* ``argument-name`` is any valid C++ identifier. 3645* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 3646 be the type of the corresponding ``argument-name``, whose second argument 3647 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 3648 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 3649 of ``previous-name ## _type``. 3650* ``type-name`` is either the name of a **target type** or an `MPL Binary 3651 Metafunction Class`_ whose first argument will be the type of the 3652 corresponding ``argument-name``, whose second argument will be the entire 3653 |ArgumentPack|_, and whose return type is the **target type**. 3654 3655Note that *specifier* does not include *default-value*. It is up to the 3656function body to determine the default value of all optional arguments. 3657 3658**Approximate expansion:** 3659 3660Where: 3661 3662* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 3663* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 3664 3665.. parsed-literal:: 3666 3667 // If **result** is a template instantiation of |boost_enable_if|_\, 3668 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 3669 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 3670 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 3671 // |std_enable_if|_\: 3672 template <typename Args> 3673 using boost_param_result\_ ## __LINE__ ## **name** = **result**; 3674 3675 // If **result** is a simple return type: 3676 template <typename Args> 3677 struct boost_param_result\_ ## __LINE__ ## **name** 3678 { 3679 typedef **result** type; 3680 }; 3681 3682 struct boost_param_params\_ ## __LINE__ ## **name** 3683 : |parameters|_\< 3684 *list of parameter specifications, based on arguments* 3685 > 3686 { 3687 }; 3688 3689 typedef boost_param_params\_ ## __LINE__ ## **name** 3690 boost_param_parameters\_ ## __LINE__ ## **name**; 3691 3692 template <typename Args> 3693 typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type 3694 boost_param_impl ## **name**\ (Args const&); 3695 3696 template <typename A0, …, typename A ## **n**> 3697 **result** **name**\ ( 3698 A0&& a0, …, A ## **n**\ && a ## **n** 3699 , typename boost_param_parameters\_ ## __LINE__ ## **name** 3700 ::match<A0, …, A ## **n**>::type 3701 = boost_param_parameters\_ ## __LINE__ ## **name**\ () 3702 ) 3703 { 3704 return boost_param_impl ## __LINE__ ## **name**\ ( 3705 boost_param_parameters\_ ## __LINE__ ## **name**\ ()( 3706 |std_forward|_\<A0>(a0) 3707 , … 3708 , |std_forward|_\<A ## **n**>(a ## **n**) 3709 ) 3710 ); 3711 } 3712 3713 :vellipsis:`⋮` 3714 3715 template <typename A0, …, typename A ## **m**> 3716 **result** **name**\ ( 3717 A0&& a0, …, A ## **m**\ && a ## **m** 3718 , typename boost_param_parameters\_ ## __LINE__ ## **name** 3719 ::match<A0, …, A ## **m**>::type 3720 = boost_param_parameters\_ ## __LINE__ ## **name**\ () 3721 ) 3722 { 3723 return boost_param_impl ## __LINE__ ## **name**\ ( 3724 boost_param_parameters\_ ## __LINE__ ## **name**\ ()( 3725 |std_forward|_\<A0>(a0) 3726 , … 3727 , |std_forward|_\<A ## **m**>(a ## **m**) 3728 ) 3729 ); 3730 } 3731 3732 template <typename Args> 3733 typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type 3734 boost_param_impl ## __LINE__ ## **name**\ (Args const& args) 3735 3736Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are 3737available for use within the function body. 3738 3739.. |BOOST_PARAMETER_BASIC_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_BASIC_MEMBER_FUNCTION`` 3740.. _BOOST_PARAMETER_BASIC_MEMBER_FUNCTION: 3741 3742``BOOST_PARAMETER_BASIC_MEMBER_FUNCTION(result, name, tag_ns, arguments)`` 3743-------------------------------------------------------------------------- 3744 3745:Defined in: |preprocessor_header|_ 3746 3747Generates a member function that can take in positional arguments, composed 3748arguments, named arguments, and deduced arguments. 3749 3750:Example usage: 3751 3752The return type of each of the following function templates falls under a 3753different value category. 3754 3755.. parsed-literal:: 3756 3757 template <std::size_t N> 3758 |std_bitset|_\<N + 1> rvalue_bitset() 3759 { 3760 return |std_bitset|_\<N + 1>(); 3761 } 3762 3763 template <std::size_t N> 3764 |std_bitset|_\<N + 1> const rvalue_const_bitset() 3765 { 3766 return |std_bitset|_\<N + 1>(); 3767 } 3768 3769 template <std::size_t N> 3770 |std_bitset|_\<N + 1>& lvalue_bitset() 3771 { 3772 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 3773 return lset; 3774 } 3775 3776 template <std::size_t N> 3777 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 3778 { 3779 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 3780 return clset; 3781 } 3782 3783The ``U::evaluate_category`` static member function template has a simple job: 3784to return the correct value category when passed in an object returned by one 3785of the functions defined above. Assume that 3786|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 3787 3788.. parsed-literal:: 3789 3790 enum invoked 3791 { 3792 passed_by_lvalue_reference_to_const 3793 , passed_by_lvalue_reference 3794 , passed_by_rvalue_reference_to_const 3795 , passed_by_rvalue_reference 3796 }; 3797 3798 struct U 3799 { 3800 template <std::size_t N> 3801 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 3802 { 3803 return passed_by_lvalue_reference_to_const; 3804 } 3805 3806 template <std::size_t N> 3807 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 3808 { 3809 return passed_by_lvalue_reference; 3810 } 3811 3812 template <std::size_t N> 3813 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 3814 { 3815 return passed_by_rvalue_reference_to_const; 3816 } 3817 3818 template <std::size_t N> 3819 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 3820 { 3821 return passed_by_rvalue_reference; 3822 } 3823 }; 3824 3825Define the named parameters that will comprise the argument specification that 3826this macro will use. Ensure that all their tag types are in the same 3827namespace, which is ``kw`` in this case. The identifiers with leading 3828underscores can be passed to the bracket operator of ``args`` to extract the 3829same argument to which the corresponding named parameter (without underscores) 3830is bound, as will be shown later. 3831 3832.. parsed-literal:: 3833 3834 |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc)) 3835 |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr)) 3836 |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc)) 3837 |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr)) 3838 3839Use the macro as a substitute for a normal ``static`` member function 3840header. Enclose the return type ``bool`` in parentheses. For each parameter, 3841also enclose the expected value type in parentheses. Since the value types 3842are mutually exclusive, you can wrap the parameters in a ``(deduced …)`` 3843clause. Otherwise, just as with a normal function, the order in which you 3844specify the parameters determines their position. However, unlike a normal 3845function, default values must be specified within the function body. Also 3846within the function body, you must pass the matching identifier with the 3847leading underscore to the bracket operator of ``args`` to extract the 3848corresponding argument, but at least this doesn't require ``std::forward`` to 3849preserve value categories. 3850 3851.. parsed-literal:: 3852 3853 struct B 3854 { 3855 BOOST_PARAMETER_BASIC_MEMBER_FUNCTION((bool), static evaluate, kw, 3856 (deduced 3857 (required 3858 (lrc, (|std_bitset|_\<1>)) 3859 (lr, (|std_bitset|_\<2>)) 3860 ) 3861 (optional 3862 (rrc, (|std_bitset|_\<3>)) 3863 (rr, (|std_bitset|_\<4>)) 3864 ) 3865 ) 3866 ) 3867 { 3868 BOOST_TEST_EQ( 3869 passed_by_lvalue_reference_to_const 3870 , U::evaluate_category<0>(args[_lrc]) 3871 ); 3872 BOOST_TEST_EQ( 3873 passed_by_lvalue_reference 3874 , U::evaluate_category<1>(args[_lr]) 3875 ); 3876 BOOST_TEST_EQ( 3877 passed_by_rvalue_reference_to_const 3878 , U::evaluate_category<2>( 3879 args[_rrc0 | rvalue_const_bitset<2>()] 3880 ) 3881 ); 3882 BOOST_TEST_EQ( 3883 passed_by_rvalue_reference 3884 , U::evaluate_category<3>( 3885 args[_rr0 | rvalue_bitset<3>()] 3886 ) 3887 ); 3888 3889 return true; 3890 } 3891 }; 3892 3893The following function calls are legal. 3894 3895.. parsed-literal:: 3896 3897 B::evaluate( // positional arguments 3898 lvalue_const_bitset<0>() 3899 , lvalue_bitset<1>() 3900 , rvalue_const_bitset<2>() 3901 , rvalue_bitset<3>() 3902 ); 3903 B::evaluate( // positional arguments 3904 lvalue_const_bitset<0>() 3905 , lvalue_bitset<1>() 3906 ); 3907 B::evaluate(( // composed arguments 3908 _rr0 = rvalue_bitset<3>() 3909 , _lrc0 = lvalue_const_bitset<0>() 3910 , _lr0 = lvalue_bitset<1>() 3911 , _rrc0 = rvalue_const_bitset<2>() 3912 )); 3913 B::evaluate( // named arguments 3914 _rr0 = rvalue_bitset<3>() 3915 , _lrc0 = lvalue_const_bitset<0>() 3916 , _lr0 = lvalue_bitset<1>() 3917 , _rrc0 = rvalue_const_bitset<2>() 3918 ); 3919 B::evaluate( // named arguments 3920 _lr0 = lvalue_bitset<1>() 3921 , _lrc0 = lvalue_const_bitset<0>() 3922 ); 3923 3924Because the parameters were wrapped in a ``(deduced …)`` clause, the following 3925function calls are also legal. 3926 3927.. parsed-literal:: 3928 3929 B::evaluate( // deduced arguments 3930 rvalue_bitset<3>() 3931 , lvalue_const_bitset<0>() 3932 , lvalue_bitset<1>() 3933 , rvalue_const_bitset<2>() 3934 ); 3935 B::evaluate( // deduced arguments 3936 lvalue_bitset<1>() 3937 , lvalue_const_bitset<0>() 3938 ); 3939 3940The |preprocessor_cpp|_ test program demonstrates proper usage of this macro. 3941 3942**Macro parameters:** 3943 3944* ``result`` is the parenthesized return type of the function. 3945* ``name`` is the base name of the function; it determines the name of the 3946 generated forwarding functions. ``name`` may be qualified by the 3947 ``static`` keyword to declare the member function and its helpers as not 3948 associated with any object of the enclosing type. 3949* ``tag_namespace`` is the namespace in which the keywords used by the 3950 function resides. 3951* ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of 3952 *argument-specifiers*, as defined below. 3953 3954**Argument specifiers syntax:** 3955 3956.. parsed-literal:: 3957 3958 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 3959 3960 specifier-group0 ::= *specifier-group1* | 3961 ( 3962 '**(**' '**deduced**' 3963 *specifier-group1* {*specifier-group1*\ } 3964 '**)**' 3965 ) 3966 3967 specifier-group1 ::= 3968 ( 3969 '**(**' '**optional**' 3970 *specifier* {*specifier*\ } 3971 '**)**' 3972 ) | ( 3973 '**(**' '**required**' 3974 *specifier* {*specifier*\ } 3975 '**)**' 3976 ) 3977 3978 specifier ::= 3979 '**(**' *argument-name* '**,**' *restriction* ')' 3980 3981 restriction ::= 3982 ( '**\***' '**(**' *mfc* '**)**' ) | 3983 ( '**(**' *type-name* '**)**' ) | 3984 '**\***' 3985 3986* ``argument-name`` is any valid C++ identifier. 3987* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 3988 be the type of the corresponding ``argument-name``, whose second argument 3989 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 3990 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 3991 of ``previous-name ## _type``. 3992* ``type-name`` is either the name of a **target type** or an `MPL Binary 3993 Metafunction Class`_ whose first argument will be the type of the 3994 corresponding ``argument-name``, whose second argument will be the entire 3995 |ArgumentPack|_, and whose return type is the **target type**. 3996 3997Note that *specifier* does not include *default-value*. It is up to the 3998function body to determine the default value of all optional arguments. 3999 4000**Approximate expansion:** 4001 4002Where: 4003 4004* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 4005* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 4006 4007.. parsed-literal:: 4008 4009 // If **result** is a template instantiation of |boost_enable_if|_\, 4010 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 4011 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 4012 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 4013 // |std_enable_if|_\: 4014 template <typename Args> 4015 using boost_param_result\_ ## __LINE__ ## **name** = **result**; 4016 4017 // If **result** is a simple return type: 4018 template <typename Args> 4019 struct boost_param_result\_ ## __LINE__ ## **name** 4020 { 4021 typedef **result** type; 4022 }; 4023 4024 struct boost_param_params\_ ## __LINE__ ## **name** 4025 : |parameters|_\< 4026 *list of parameter specifications, based on arguments* 4027 > 4028 { 4029 }; 4030 4031 typedef boost_param_params\_ ## __LINE__ ## **name** 4032 boost_param_parameters\_ ## __LINE__ ## **name**; 4033 4034 template <typename A0, …, typename A ## **n**> 4035 **result** **name**\ ( 4036 A0&& a0, …, A ## **n**\ && a ## **n** 4037 , typename boost_param_parameters\_ ## __LINE__ ## **name** 4038 ::match<A0, …, A ## **n**>::type 4039 = boost_param_parameters\_ ## __LINE__ ## **name**\ () 4040 ) 4041 { 4042 return this->boost_param_impl ## **name**\ ( 4043 boost_param_parameters\_ ## __LINE__ ## **name**\ ()( 4044 |std_forward|_\<A0>(a0) 4045 , … 4046 , |std_forward|_\<A ## **n**>(a ## **n**) 4047 ) 4048 ); 4049 } 4050 4051 :vellipsis:`⋮` 4052 4053 template <typename A0, …, typename A ## **m**> 4054 **result** **name**\ ( 4055 A0&& a0, …, A ## **m**\ && a ## **m** 4056 , typename boost_param_parameters\_ ## __LINE__ ## **name** 4057 ::match<A0, …, A ## **m**>::type 4058 = boost_param_parameters\_ ## __LINE__ ## **name**\ () 4059 ) 4060 { 4061 return this->boost_param_impl ## **name**\ ( 4062 boost_param_parameters\_ ## __LINE__ ## **name**\ ()( 4063 |std_forward|_\<A0>(a0) 4064 , … 4065 , |std_forward|_\<A ## **m**>(a ## **m**) 4066 ) 4067 ); 4068 } 4069 4070 template <typename Args> 4071 typename boost_param_result\_ ## __LINE__ ## **name**\ <Args>::type 4072 boost_param_impl ## **name**\ (Args const& args) 4073 4074Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are 4075available for use within the function body. 4076 4077.. |BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION`` 4078.. _BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION: 4079 4080``BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION(result, name, tag_ns, args)`` 4081--------------------------------------------------------------------------- 4082 4083:Defined in: |preprocessor_header|_ 4084 4085Generates a member function that can take in positional arguments, composed 4086arguments, named arguments, and deduced arguments. 4087 4088:Example usage: 4089 4090The return type of each of the following function templates falls under a 4091different value category. 4092 4093.. parsed-literal:: 4094 4095 template <std::size_t N> 4096 |std_bitset|_\<N + 1> rvalue_bitset() 4097 { 4098 return |std_bitset|_\<N + 1>(); 4099 } 4100 4101 template <std::size_t N> 4102 |std_bitset|_\<N + 1> const rvalue_const_bitset() 4103 { 4104 return |std_bitset|_\<N + 1>(); 4105 } 4106 4107 template <std::size_t N> 4108 |std_bitset|_\<N + 1>& lvalue_bitset() 4109 { 4110 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 4111 return lset; 4112 } 4113 4114 template <std::size_t N> 4115 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 4116 { 4117 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 4118 return clset; 4119 } 4120 4121The ``U::evaluate_category`` static member function template has a simple job: 4122to return the correct value category when passed in an object returned by one 4123of the functions defined above. Assume that 4124|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 4125 4126.. parsed-literal:: 4127 4128 enum invoked 4129 { 4130 passed_by_lvalue_reference_to_const 4131 , passed_by_lvalue_reference 4132 , passed_by_rvalue_reference_to_const 4133 , passed_by_rvalue_reference 4134 }; 4135 4136 struct U 4137 { 4138 template <std::size_t N> 4139 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 4140 { 4141 return passed_by_lvalue_reference_to_const; 4142 } 4143 4144 template <std::size_t N> 4145 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 4146 { 4147 return passed_by_lvalue_reference; 4148 } 4149 4150 template <std::size_t N> 4151 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 4152 { 4153 return passed_by_rvalue_reference_to_const; 4154 } 4155 4156 template <std::size_t N> 4157 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 4158 { 4159 return passed_by_rvalue_reference; 4160 } 4161 }; 4162 4163Define the named parameters that will comprise the argument specification that 4164this macro will use. Ensure that all their tag types are in the same 4165namespace, which is ``kw`` in this case. The identifiers with leading 4166underscores can be passed to the bracket operator of ``args`` to extract the 4167same argument to which the corresponding named parameter (without underscores) 4168is bound, as will be shown later. 4169 4170.. parsed-literal:: 4171 4172 |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc)) 4173 |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr)) 4174 |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc)) 4175 |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr)) 4176 4177Use the macro as a substitute for a normal ``const`` member function 4178header. Enclose the return type ``bool`` in parentheses. For each parameter, 4179also enclose the expected value type in parentheses. Since the value types 4180are mutually exclusive, you can wrap the parameters in a ``(deduced …)`` 4181clause. Otherwise, just as with a normal function, the order in which you 4182specify the parameters determines their position. However, unlike a normal 4183function, default values must be specified within the function body. Also 4184within the function body, you must pass the matching identifier with the 4185leading underscore to the bracket operator of ``args`` to extract the 4186corresponding argument, but at least this doesn't require ``std::forward`` to 4187preserve value categories. 4188 4189.. parsed-literal:: 4190 4191 struct B 4192 { 4193 B() 4194 { 4195 } 4196 4197 BOOST_PARAMETER_BASIC_CONST_MEMBER_FUNCTION((bool), evaluate, kw, 4198 (deduced 4199 (required 4200 (lrc, (|std_bitset|_\<1>)) 4201 (lr, (|std_bitset|_\<2>)) 4202 ) 4203 (optional 4204 (rrc, (|std_bitset|_\<3>)) 4205 (rr, (|std_bitset|_\<4>)) 4206 ) 4207 ) 4208 ) 4209 { 4210 BOOST_TEST_EQ( 4211 passed_by_lvalue_reference_to_const 4212 , U::evaluate_category<0>(args[_lrc]) 4213 ); 4214 BOOST_TEST_EQ( 4215 passed_by_lvalue_reference 4216 , U::evaluate_category<1>(args[_lr]) 4217 ); 4218 BOOST_TEST_EQ( 4219 passed_by_rvalue_reference_to_const 4220 , U::evaluate_category<2>( 4221 args[_rrc0 | rvalue_const_bitset<2>()] 4222 ) 4223 ); 4224 BOOST_TEST_EQ( 4225 passed_by_rvalue_reference 4226 , U::evaluate_category<3>( 4227 args[_rr0 | rvalue_bitset<3>()] 4228 ) 4229 ); 4230 4231 return true; 4232 } 4233 }; 4234 4235The following function calls are legal. 4236 4237.. parsed-literal:: 4238 4239 B const b = B(); 4240 b.evaluate( // positional arguments 4241 lvalue_const_bitset<0>() 4242 , lvalue_bitset<1>() 4243 , rvalue_const_bitset<2>() 4244 , rvalue_bitset<3>() 4245 ); 4246 b.evaluate( // positional arguments 4247 lvalue_const_bitset<0>() 4248 , lvalue_bitset<1>() 4249 ); 4250 b.evaluate(( // composed arguments 4251 _rr0 = rvalue_bitset<3>() 4252 , _lrc0 = lvalue_const_bitset<0>() 4253 , _lr0 = lvalue_bitset<1>() 4254 , _rrc0 = rvalue_const_bitset<2>() 4255 )); 4256 b.evaluate( // named arguments 4257 _rr0 = rvalue_bitset<3>() 4258 , _lrc0 = lvalue_const_bitset<0>() 4259 , _lr0 = lvalue_bitset<1>() 4260 , _rrc0 = rvalue_const_bitset<2>() 4261 ); 4262 b.evaluate( // named arguments 4263 _lr0 = lvalue_bitset<1>() 4264 , _lrc0 = lvalue_const_bitset<0>() 4265 ); 4266 4267Because the parameters were wrapped in a ``(deduced …)`` clause, the following 4268function calls are also legal. 4269 4270.. parsed-literal:: 4271 4272 b.evaluate( // deduced arguments 4273 rvalue_bitset<3>() 4274 , lvalue_const_bitset<0>() 4275 , lvalue_bitset<1>() 4276 , rvalue_const_bitset<2>() 4277 ); 4278 b.evaluate( // deduced arguments 4279 lvalue_bitset<1>() 4280 , lvalue_const_bitset<0>() 4281 ); 4282 4283The |preprocessor_cpp|_ test program demonstrates proper usage of this macro. 4284 4285**Macro parameters:** 4286 4287* ``result`` is the parenthesized return type of the function. 4288* ``name`` is the base name of the function; it determines the name of the 4289 generated forwarding functions. 4290* ``tag_namespace`` is the namespace in which the keywords used by the 4291 function resides. 4292* ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of 4293 *argument-specifiers*, as defined below. 4294 4295**Argument specifiers syntax:** 4296 4297.. parsed-literal:: 4298 4299 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 4300 4301 specifier-group0 ::= *specifier-group1* | 4302 ( 4303 '**(**' '**deduced**' 4304 *specifier-group1* {*specifier-group1*\ } 4305 '**)**' 4306 ) 4307 4308 specifier-group1 ::= 4309 ( 4310 '**(**' '**optional**' 4311 *specifier* {*specifier*\ } 4312 '**)**' 4313 ) | ( 4314 '**(**' '**required**' 4315 *specifier* {*specifier*\ } 4316 '**)**' 4317 ) 4318 4319 specifier ::= 4320 '**(**' *argument-name* '**,**' *restriction* ')' 4321 4322 restriction ::= 4323 ( '**\***' '**(**' *mfc* '**)**' ) | 4324 ( '**(**' *type-name* '**)**' ) | 4325 '**\***' 4326 4327* ``argument-name`` is any valid C++ identifier. 4328* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 4329 be the type of the corresponding ``argument-name``, whose second argument 4330 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 4331 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 4332 of ``previous-name ## _type``. 4333* ``type-name`` is either the name of a **target type** or an `MPL Binary 4334 Metafunction Class`_ whose first argument will be the type of the 4335 corresponding ``argument-name``, whose second argument will be the entire 4336 |ArgumentPack|_, and whose return type is the **target type**. 4337 4338Note that *specifier* does not include *default-value*. It is up to the 4339function body to determine the default value of all optional arguments. 4340 4341**Approximate expansion:** 4342 4343Where: 4344 4345* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 4346* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 4347 4348.. parsed-literal:: 4349 4350 // If **result** is a template instantiation of |boost_enable_if|_\, 4351 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 4352 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 4353 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 4354 // |std_enable_if|_\: 4355 template <typename Args> 4356 using boost_param_result_const\_ ## __LINE__ ## **name** = **result**; 4357 4358 // If **result** is a simple return type: 4359 template <typename Args> 4360 struct boost_param_result_const\_ ## __LINE__ ## **name** 4361 { 4362 typedef **result** type; 4363 }; 4364 4365 struct boost_param_params_const\_ ## __LINE__ ## **name** 4366 : |parameters|_\< 4367 *list of parameter specifications, based on arguments* 4368 > 4369 { 4370 }; 4371 4372 typedef boost_param_params_const\_ ## __LINE__ ## **name** 4373 boost_param_parameters_const\_ ## __LINE__ ## **name**; 4374 4375 template <typename A0, …, typename A ## **n**> 4376 **result** **name**\ ( 4377 A0&& a0, …, A ## **n**\ && a ## **n** 4378 , typename boost_param_parameters_const\_ ## __LINE__ ## **name** 4379 ::match<A0, …, A ## **n**>::type 4380 = boost_param_parameters_const\_ ## __LINE__ ## **name**\ () 4381 ) const 4382 { 4383 return this->boost_param_impl_const ## __LINE__ ## **name**\ ( 4384 boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()( 4385 |std_forward|_\<A0>(a0) 4386 , … 4387 , |std_forward|_\<A ## **n**>(a ## **n**) 4388 ) 4389 ); 4390 } 4391 4392 :vellipsis:`⋮` 4393 4394 template <typename A0, …, typename A ## **m**> 4395 **result** **name**\ ( 4396 A0&& a0, …, A ## **m**\ && a ## **m** 4397 , typename boost_param_parameters_const\_ ## __LINE__ ## **name** 4398 ::match<A0, …, A ## **m**>::type 4399 = boost_param_parameters_const\_ ## __LINE__ ## **name**\ () 4400 ) const 4401 { 4402 return this->boost_param_impl_const ## __LINE__ ## **name**\ ( 4403 boost_param_parameters_const\_ ## __LINE__ ## **name**\ ()( 4404 |std_forward|_\<A0>(a0) 4405 , … 4406 , |std_forward|_\<A ## **m**>(a ## **m**) 4407 ) 4408 ); 4409 } 4410 4411 template <typename Args> 4412 typename boost_param_result_const\_ ## __LINE__ ## **name**\ <Args>::type 4413 boost_param_impl_const ## __LINE__ ## **name**\ (Args const& args) const 4414 4415Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are 4416available for use within the function body. 4417 4418.. |BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR`` 4419.. _BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR: 4420 4421``BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR(result, tag_ns, arguments)`` 4422--------------------------------------------------------------------------- 4423 4424:Defined in: |preprocessor_header|_ 4425 4426Generates a function call operator that can take in positional arguments, 4427composed arguments, named arguments, and deduced arguments. 4428 4429:Example usage: 4430 4431Define the named parameters that will comprise the argument specification that 4432this macro will use. Ensure that all their tag types are in the same 4433namespace, which is ``tag`` by default. 4434 4435.. parsed-literal:: 4436 4437 |BOOST_PARAMETER_NAME|_\(y) 4438 |BOOST_PARAMETER_NAME|_\(z) 4439 4440Use the macro as a substitute for a normal function call operator 4441header. Enclose the return type in parentheses. For each parameter, also 4442enclose the expected value type in parentheses. Since the value types are 4443mutually exclusive, you can wrap the parameters in a ``(deduced …)`` 4444clause. This is especially useful when implementing multiple 4445Boost.Parameter-enabled function call operator overloads. 4446 4447.. parsed-literal:: 4448 4449 class char_reader 4450 { 4451 int index; 4452 char const* key; 4453 4454 public: 4455 explicit char_reader(char const* k) : index(0), key(k) 4456 { 4457 } 4458 4459 BOOST_PARAMETER_BASIC_FUNCTION_CALL_OPERATOR((void), tag, 4460 (deduced 4461 (required 4462 (y, (int)) 4463 (z, (char const*)) 4464 ) 4465 ) 4466 ) 4467 { 4468 this->index = args[_y]; 4469 this->key = args[_z]; 4470 } 4471 4472 |BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR|_\((char), tag, 4473 (deduced 4474 (required 4475 (y, (bool)) 4476 (z, (|std_map|_\<char const*, |std_string|_\>)) 4477 ) 4478 ) 4479 ) 4480 { 4481 return args[_y] ? ( 4482 (args[_z].find(this->key)->second)[this->index] 4483 ) : this->key[this->index]; 4484 } 4485 }; 4486 4487As with regular argument-dependent lookup, the value types of the arguments 4488passed in determine which function call operator overload gets invoked. 4489 4490.. parsed-literal:: 4491 4492 char const* keys[] = {"foo", "bar", "baz"}; 4493 |std_map|_\<char const*, |std_string|_\> k2s; 4494 k2s[keys[0]] = |std_string|_\("qux"); 4495 k2s[keys[1]] = |std_string|_\("wmb"); 4496 k2s[keys[2]] = |std_string|_\("zxc"); 4497 char_reader r(keys[0]); 4498 4499 // positional arguments 4500 BOOST_TEST_EQ('q', (r(true, k2s))); 4501 BOOST_TEST_EQ('f', (r(false, k2s))); 4502 4503 // named arguments 4504 r(_z = keys[1], _y = 1); 4505 BOOST_TEST_EQ('m', (r(_z = k2s, _y = true))); 4506 BOOST_TEST_EQ('a', (r(_z = k2s, _y = false))); 4507 4508 // deduced arguments 4509 r(keys[2], 2); 4510 BOOST_TEST_EQ('c', (r(k2s, true))); 4511 BOOST_TEST_EQ('z', (r(k2s, false))); 4512 4513The |preprocessor_cpp|_ test program demonstrates proper usage of this macro. 4514 4515**Macro parameters:** 4516 4517* ``result`` is the parenthesized return type of the function call operator. 4518* ``tag_namespace`` is the namespace in which the keywords used by the 4519 function call operator resides. 4520* ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of 4521 *argument-specifiers*, as defined below. 4522 4523**Argument specifiers syntax:** 4524 4525.. parsed-literal:: 4526 4527 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 4528 4529 specifier-group0 ::= *specifier-group1* | 4530 ( 4531 '**(**' '**deduced**' 4532 *specifier-group1* {*specifier-group1*\ } 4533 '**)**' 4534 ) 4535 4536 specifier-group1 ::= 4537 ( 4538 '**(**' '**optional**' 4539 *specifier* {*specifier*\ } 4540 '**)**' 4541 ) | ( 4542 '**(**' '**required**' 4543 *specifier* {*specifier*\ } 4544 '**)**' 4545 ) 4546 4547 specifier ::= 4548 '**(**' *argument-name* '**,**' *restriction* ')' 4549 4550 restriction ::= 4551 ( '**\***' '**(**' *mfc* '**)**' ) | 4552 ( '**(**' *type-name* '**)**' ) | 4553 '**\***' 4554 4555* ``argument-name`` is any valid C++ identifier. 4556* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 4557 be the type of the corresponding ``argument-name``, whose second argument 4558 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 4559 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 4560 of ``previous-name ## _type``. 4561* ``type-name`` is either the name of a **target type** or an `MPL Binary 4562 Metafunction Class`_ whose first argument will be the type of the 4563 corresponding ``argument-name``, whose second argument will be the entire 4564 |ArgumentPack|_, and whose return type is the **target type**. 4565 4566Note that *specifier* does not include *default-value*. It is up to the 4567function body to determine the default value of all optional arguments. 4568 4569**Approximate expansion:** 4570 4571Where: 4572 4573* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 4574* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 4575 4576.. parsed-literal:: 4577 4578 // If **result** is a template instantiation of |boost_enable_if|_\, 4579 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 4580 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 4581 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 4582 // |std_enable_if|_\: 4583 template <typename Args> 4584 using boost_param_result\_ ## __LINE__ ## operator = **result**; 4585 4586 // If **result** is a simple return type: 4587 template <typename Args> 4588 struct boost_param_result\_ ## __LINE__ ## operator 4589 { 4590 typedef **result** type; 4591 }; 4592 4593 struct boost_param_params\_ ## __LINE__ ## operator 4594 : |parameters|_\< 4595 *list of parameter specifications, based on arguments* 4596 > 4597 { 4598 }; 4599 4600 typedef boost_param_params\_ ## __LINE__ ## operator 4601 boost_param_parameters\_ ## __LINE__ ## operator; 4602 4603 template <typename A0, …, typename A ## **n**> 4604 **result** operator()( 4605 A0&& a0, …, A ## **n**\ && a ## **n** 4606 , typename boost_param_parameters\_ ## __LINE__ ## operator::match< 4607 A0, …, A ## **n** 4608 >::type = boost_param_parameters\_ ## __LINE__ ## operator() 4609 ) 4610 { 4611 return this->boost_param_impl ## __LINE__ ## operator( 4612 boost_param_parameters\_ ## __LINE__ ## operator()( 4613 |std_forward|_\<A0>(a0) 4614 , … 4615 , |std_forward|_\<A ## **n**>(a ## **n**) 4616 ) 4617 ); 4618 } 4619 4620 :vellipsis:`⋮` 4621 4622 template <typename A0, …, typename A ## **m**> 4623 **result** operator()( 4624 A0&& a0, …, A ## **m**\ && a ## **m** 4625 , typename boost_param_parameters\_ ## __LINE__ ## operator::match< 4626 A0, …, A ## **m** 4627 >::type = boost_param_parameters\_ ## __LINE__ ## operator() 4628 ) 4629 { 4630 return this->boost_param_impl ## __LINE__ ## operator( 4631 boost_param_parameters\_ ## __LINE__ ## operator()( 4632 |std_forward|_\<A0>(a0) 4633 , … 4634 , |std_forward|_\<A ## **m**>(a ## **m**) 4635 ) 4636 ); 4637 } 4638 4639 template <typename Args> 4640 typename boost_param_result\_ ## __LINE__ ## operator<Args>::type 4641 boost_param_impl ## __LINE__ ## operator(Args const& args) 4642 4643Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are 4644available for use within the function call operator body. 4645 4646.. |BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR`` 4647.. _BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR: 4648 4649``BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR(result, tag_ns, args)`` 4650---------------------------------------------------------------------------- 4651 4652:Defined in: |preprocessor_header|_ 4653 4654Generates a function call operator that can take in positional arguments, 4655composed arguments, named arguments, and deduced arguments. 4656 4657:Example usage: 4658 4659The return type of each of the following function templates falls under a 4660different value category. 4661 4662.. parsed-literal:: 4663 4664 template <std::size_t N> 4665 |std_bitset|_\<N + 1> rvalue_bitset() 4666 { 4667 return |std_bitset|_\<N + 1>(); 4668 } 4669 4670 template <std::size_t N> 4671 |std_bitset|_\<N + 1> const rvalue_const_bitset() 4672 { 4673 return |std_bitset|_\<N + 1>(); 4674 } 4675 4676 template <std::size_t N> 4677 |std_bitset|_\<N + 1>& lvalue_bitset() 4678 { 4679 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 4680 return lset; 4681 } 4682 4683 template <std::size_t N> 4684 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 4685 { 4686 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 4687 return clset; 4688 } 4689 4690The ``U::evaluate_category`` static member function template has a simple job: 4691to return the correct value category when passed in an object returned by one 4692of the functions defined above. Assume that 4693|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 4694 4695.. parsed-literal:: 4696 4697 enum invoked 4698 { 4699 passed_by_lvalue_reference_to_const 4700 , passed_by_lvalue_reference 4701 , passed_by_rvalue_reference_to_const 4702 , passed_by_rvalue_reference 4703 }; 4704 4705 struct U 4706 { 4707 template <std::size_t N> 4708 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 4709 { 4710 return passed_by_lvalue_reference_to_const; 4711 } 4712 4713 template <std::size_t N> 4714 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 4715 { 4716 return passed_by_lvalue_reference; 4717 } 4718 4719 template <std::size_t N> 4720 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 4721 { 4722 return passed_by_rvalue_reference_to_const; 4723 } 4724 4725 template <std::size_t N> 4726 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 4727 { 4728 return passed_by_rvalue_reference; 4729 } 4730 }; 4731 4732Define the named parameters that will comprise the argument specification that 4733this macro will use. Ensure that all their tag types are in the same 4734namespace, which is ``kw`` in this case. The identifiers with leading 4735underscores can be passed to the bracket operator of ``args`` to extract the 4736same argument to which the corresponding named parameter (without underscores) 4737is bound, as will be shown later. 4738 4739.. parsed-literal:: 4740 4741 |BOOST_PARAMETER_NAME|_\((_lrc, kw) in(lrc)) 4742 |BOOST_PARAMETER_NAME|_\((_lr, kw) in_out(lr)) 4743 |BOOST_PARAMETER_NAME|_\((_rrc, kw) in(rrc)) 4744 |BOOST_PARAMETER_NAME|_\((_rr, kw) consume(rr)) 4745 4746Use the macro as a substitute for a normal ``const`` function call operator 4747header. Enclose the return type ``bool`` in parentheses. For each parameter, 4748also enclose the expected value type in parentheses. Since the value types 4749are mutually exclusive, you can wrap the parameters in a ``(deduced …)`` 4750clause. Otherwise, just as with a normal function, the order in which you 4751specify the parameters determines their position. However, unlike a normal 4752function, default values must be specified within the function body. Also 4753within the function body, you must pass the matching identifier with the 4754leading underscore to the bracket operator of ``args`` to extract the 4755corresponding argument, but at least this doesn't require ``std::forward`` to 4756preserve value categories. 4757 4758.. parsed-literal:: 4759 4760 struct B 4761 { 4762 B() 4763 { 4764 } 4765 4766 BOOST_PARAMETER_BASIC_CONST_FUNCTION_CALL_OPERATOR((bool), kw, 4767 (deduced 4768 (required 4769 (lrc, (|std_bitset|_\<1>)) 4770 (lr, (|std_bitset|_\<2>)) 4771 ) 4772 (optional 4773 (rrc, (|std_bitset|_\<3>)) 4774 (rr, (|std_bitset|_\<4>)) 4775 ) 4776 ) 4777 ) 4778 { 4779 BOOST_TEST_EQ( 4780 passed_by_lvalue_reference_to_const 4781 , U::evaluate_category<0>(args[_lrc]) 4782 ); 4783 BOOST_TEST_EQ( 4784 passed_by_lvalue_reference 4785 , U::evaluate_category<1>(args[_lr]) 4786 ); 4787 BOOST_TEST_EQ( 4788 passed_by_rvalue_reference_to_const 4789 , U::evaluate_category<2>( 4790 args[_rrc0 | rvalue_const_bitset<2>()] 4791 ) 4792 ); 4793 BOOST_TEST_EQ( 4794 passed_by_rvalue_reference 4795 , U::evaluate_category<3>( 4796 args[_rr0 | rvalue_bitset<3>()] 4797 ) 4798 ); 4799 4800 return true; 4801 } 4802 }; 4803 4804The following function calls are legal. 4805 4806.. parsed-literal:: 4807 4808 B const b = B(); 4809 b( // positional arguments 4810 lvalue_const_bitset<0>() 4811 , lvalue_bitset<1>() 4812 , rvalue_const_bitset<2>() 4813 , rvalue_bitset<3>() 4814 ); 4815 b( // positional arguments 4816 lvalue_const_bitset<0>() 4817 , lvalue_bitset<1>() 4818 ); 4819 b(( // composed arguments 4820 _rr0 = rvalue_bitset<3>() 4821 , _lrc0 = lvalue_const_bitset<0>() 4822 , _lr0 = lvalue_bitset<1>() 4823 , _rrc0 = rvalue_const_bitset<2>() 4824 )); 4825 b( // named arguments 4826 _rr0 = rvalue_bitset<3>() 4827 , _lrc0 = lvalue_const_bitset<0>() 4828 , _lr0 = lvalue_bitset<1>() 4829 , _rrc0 = rvalue_const_bitset<2>() 4830 ); 4831 b( // named arguments 4832 _lr0 = lvalue_bitset<1>() 4833 , _lrc0 = lvalue_const_bitset<0>() 4834 ); 4835 4836Because the parameters were wrapped in a ``(deduced …)`` clause, the following 4837function calls are also legal. 4838 4839.. parsed-literal:: 4840 4841 b( // deduced arguments 4842 rvalue_bitset<3>() 4843 , lvalue_const_bitset<0>() 4844 , lvalue_bitset<1>() 4845 , rvalue_const_bitset<2>() 4846 ); 4847 b( // deduced arguments 4848 lvalue_bitset<1>() 4849 , lvalue_const_bitset<0>() 4850 ); 4851 4852The |preprocessor_cpp|_ test program demonstrates proper usage of this macro. 4853 4854**Macro parameters:** 4855 4856* ``result`` is the parenthesized return type of the function call operator. 4857* ``tag_namespace`` is the namespace in which the keywords used by the 4858 function call operator resides. 4859* ``arguments`` is a |Boost_Preprocessor|_ `sequence`_ of 4860 *argument-specifiers*, as defined below. 4861 4862**Argument specifiers syntax:** 4863 4864.. parsed-literal:: 4865 4866 argument-specifiers ::= *specifier-group0* {*specifier-group0*\ } 4867 4868 specifier-group0 ::= *specifier-group1* | 4869 ( 4870 '**(**' '**deduced**' 4871 *specifier-group1* {*specifier-group1*\ } 4872 '**)**' 4873 ) 4874 4875 specifier-group1 ::= 4876 ( 4877 '**(**' '**optional**' 4878 *specifier* {*specifier*\ } 4879 '**)**' 4880 ) | ( 4881 '**(**' '**required**' 4882 *specifier* {*specifier*\ } 4883 '**)**' 4884 ) 4885 4886 specifier ::= 4887 '**(**' *argument-name* '**,**' *restriction* ')' 4888 4889 restriction ::= 4890 ( '**\***' '**(**' *mfc* '**)**' ) | 4891 ( '**(**' *type-name* '**)**' ) | 4892 '**\***' 4893 4894* ``argument-name`` is any valid C++ identifier. 4895* ``mfc`` is an `MPL Binary Metafunction Class`_ whose first argument will 4896 be the type of the corresponding ``argument-name``, whose second argument 4897 will be the entire |ArgumentPack|_, and whose return type is a `Boolean 4898 Integral Constant`_; however, user code *cannot* compute ``mfc`` in terms 4899 of ``previous-name ## _type``. 4900* ``type-name`` is either the name of a **target type** or an `MPL Binary 4901 Metafunction Class`_ whose first argument will be the type of the 4902 corresponding ``argument-name``, whose second argument will be the entire 4903 |ArgumentPack|_, and whose return type is the **target type**. 4904 4905Note that *specifier* does not include *default-value*. It is up to the 4906function body to determine the default value of all optional arguments. 4907 4908**Approximate expansion:** 4909 4910Where: 4911 4912* ``n`` denotes the *minimum* arity, as determined from ``arguments``. 4913* ``m`` denotes the *maximum* arity, as determined from ``arguments``. 4914 4915.. parsed-literal:: 4916 4917 // If **result** is a template instantiation of |boost_enable_if|_\, 4918 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 4919 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 4920 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 4921 // |std_enable_if|_\: 4922 template <typename Args> 4923 using boost_param_result_const\_ ## __LINE__ ## operator = **result**; 4924 4925 // If **result** is a simple return type: 4926 template <typename Args> 4927 struct boost_param_result_const\_ ## __LINE__ ## operator 4928 { 4929 typedef **result** type; 4930 }; 4931 4932 struct boost_param_params_const\_ ## __LINE__ ## operator 4933 : |parameters|_\< 4934 *list of parameter specifications, based on arguments* 4935 > 4936 { 4937 }; 4938 4939 typedef boost_param_params_const\_ ## __LINE__ ## operator 4940 boost_param_parameters_const\_ ## __LINE__ ## operator; 4941 4942 template <typename A0, …, typename A ## **n**> 4943 **result** operator()( 4944 A0&& a0, …, A ## **n**\ && a ## **n** 4945 , typename boost_param_parameters_const\_ ## __LINE__ ## operator 4946 ::match<A0, …, A ## **n**>::type 4947 = boost_param_parameters_const\_ ## __LINE__ ## operator() 4948 ) const 4949 { 4950 return this->boost_param_impl_const ## __LINE__ ## operator( 4951 boost_param_parameters_const\_ ## __LINE__ ## operator()( 4952 |std_forward|_\<A0>(a0) 4953 , … 4954 , |std_forward|_\<A ## **n**>(a ## **n**) 4955 ) 4956 ); 4957 } 4958 4959 :vellipsis:`⋮` 4960 4961 template <typename A0, …, typename A ## **m**> 4962 **result** operator()( 4963 A0&& a0, …, A ## **m**\ && a ## **m** 4964 , typename boost_param_parameters_const\_ ## __LINE__ ## operator 4965 ::match<A0, …, A ## **m**>::type 4966 = boost_param_parameters_const\_ ## __LINE__ ## operator() 4967 ) const 4968 { 4969 return this->boost_param_impl_const ## __LINE__ ## operator( 4970 boost_param_parameters_const\_ ## __LINE__ ## operator()( 4971 |std_forward|_\<A0>(a0) 4972 , … 4973 , |std_forward|_\<A ## **m**>(a ## **m**) 4974 ) 4975 ); 4976 } 4977 4978 template <typename Args> 4979 typename boost_param_result_const\_ ## __LINE__ ## operator<Args>::type 4980 boost_param_impl_const ## __LINE__ ## operator(Args const& args) const 4981 4982Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are 4983available for use within the function call operator body. 4984 4985.. |BOOST_PARAMETER_NO_SPEC_FUNCTION| replace:: ``BOOST_PARAMETER_NO_SPEC_FUNCTION`` 4986.. _BOOST_PARAMETER_NO_SPEC_FUNCTION: 4987 4988``BOOST_PARAMETER_NO_SPEC_FUNCTION(result, name)`` 4989-------------------------------------------------- 4990 4991:Defined in: |preprocessor_no_spec_header|_ 4992 4993Generates a function that can take in named arguments. 4994 4995:Example usage: 4996 4997The return type of each of the following function templates falls under a 4998different value category. 4999 5000.. parsed-literal:: 5001 5002 template <std::size_t N> 5003 |std_bitset|_\<N + 1> rvalue_bitset() 5004 { 5005 return |std_bitset|_\<N + 1>(); 5006 } 5007 5008 template <std::size_t N> 5009 |std_bitset|_\<N + 1> const rvalue_const_bitset() 5010 { 5011 return |std_bitset|_\<N + 1>(); 5012 } 5013 5014 template <std::size_t N> 5015 |std_bitset|_\<N + 1>& lvalue_bitset() 5016 { 5017 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 5018 return lset; 5019 } 5020 5021 template <std::size_t N> 5022 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 5023 { 5024 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 5025 return clset; 5026 } 5027 5028The ``U::evaluate_category`` static member function template has a simple job: 5029to return the correct value category when passed in an object returned by one 5030of the functions defined above. Assume that 5031|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 5032 5033.. parsed-literal:: 5034 5035 enum invoked 5036 { 5037 passed_by_lvalue_reference_to_const 5038 , passed_by_lvalue_reference 5039 , passed_by_rvalue_reference_to_const 5040 , passed_by_rvalue_reference 5041 }; 5042 5043 struct U 5044 { 5045 template <std::size_t N> 5046 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 5047 { 5048 return passed_by_lvalue_reference_to_const; 5049 } 5050 5051 template <std::size_t N> 5052 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 5053 { 5054 return passed_by_lvalue_reference; 5055 } 5056 5057 template <std::size_t N> 5058 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 5059 { 5060 return passed_by_rvalue_reference_to_const; 5061 } 5062 5063 template <std::size_t N> 5064 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 5065 { 5066 return passed_by_rvalue_reference; 5067 } 5068 }; 5069 5070Named parameters are required when invoking the function; however, none of 5071their tags need to be in the same namespace. 5072 5073.. parsed-literal:: 5074 5075 |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc)) 5076 |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr)) 5077 |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc)) 5078 |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr)) 5079 5080Use the macro as a substitute for a variadic function header. Enclose the 5081return type ``bool`` in parentheses. 5082 5083.. parsed-literal:: 5084 5085 BOOST_PARAMETER_NO_SPEC_FUNCTION((bool), evaluate) 5086 { 5087 BOOST_TEST_EQ( 5088 passed_by_lvalue_reference_to_const 5089 , U::evaluate_category<0>(args[_lrc]) 5090 ); 5091 BOOST_TEST_EQ( 5092 passed_by_lvalue_reference 5093 , U::evaluate_category<1>(args[_lr]) 5094 ); 5095 BOOST_TEST_EQ( 5096 passed_by_rvalue_reference_to_const 5097 , U::evaluate_category<2>( 5098 args[_rrc | rvalue_const_bitset<2>()] 5099 ) 5100 ); 5101 BOOST_TEST_EQ( 5102 passed_by_rvalue_reference 5103 , U::evaluate_category<3>(args[_rr | rvalue_bitset<3>()]) 5104 ); 5105 5106 return true; 5107 } 5108 5109To invoke the function, bind all its arguments to named parameters. 5110 5111.. parsed-literal:: 5112 5113 evaluate( 5114 _rr0 = rvalue_bitset<3>() 5115 , _lrc0 = lvalue_const_bitset<0>() 5116 , _lr0 = lvalue_bitset<1>() 5117 , _rrc0 = rvalue_const_bitset<2>() 5118 ); 5119 evaluate( 5120 _lr0 = lvalue_bitset<1>() 5121 , _lrc0 = lvalue_const_bitset<0>() 5122 ); 5123 5124The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of 5125this macro. 5126 5127**Macro parameters:** 5128 5129* ``result`` is the parenthesized return type of the function. 5130* ``name`` is the base name of the function; it determines the name of the 5131 generated implementation function. 5132 5133**Argument specifiers syntax:** 5134 5135None. 5136 5137**Approximate expansion:** 5138 5139.. parsed-literal:: 5140 5141 // If **result** is a template instantiation of |boost_enable_if|_\, 5142 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 5143 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 5144 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 5145 // |std_enable_if|_\: 5146 template <typename TaggedArg0, typename ...TaggedArgs> 5147 using boost_param_no_spec_result\_ ## __LINE__ ## **name** = **result**; 5148 5149 // If **result** is a simple return type: 5150 template <typename TaggedArg0, typename ...TaggedArgs> 5151 struct boost_param_no_spec_result\_ ## __LINE__ ## **name** 5152 { 5153 typedef **result** type; 5154 }; 5155 5156 template <typename ResultType, typename Args> 5157 ResultType 5158 boost_param_no_spec_impl ## __LINE__ ## **name**\ ( 5159 (ResultType(*)()) 5160 , Args const& args 5161 ); 5162 5163 template <typename TaggedArg0, typename ...TaggedArgs> 5164 inline typename |boost_lazy_enable_if|_\< 5165 |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...> 5166 , boost_param_no_spec_result\_ ## __LINE__ ## **name**\ < 5167 TaggedArg0 5168 , TaggedArgs... 5169 > 5170 >::type 5171 **name**\ (TaggedArg0 const& arg0, TaggedArgs const&... args) 5172 { 5173 return boost_param_no_spec_impl ## __LINE__ ## **name**\ ( 5174 static_cast< 5175 typename 5176 boost_param_no_spec_result\_ ## __LINE__ ## **name**\ < 5177 TaggedArg0 5178 , TaggedArgs... 5179 >::type(*)() 5180 >(|std_nullptr|_\) 5181 , |compose|_\(arg0, args...) 5182 ); 5183 } 5184 5185 template <typename ResultType, typename Args> 5186 ResultType 5187 boost_param_no_spec_impl ## __LINE__ ## **name**\ ( 5188 (ResultType(*)()) 5189 , Args const& args 5190 ) 5191 5192Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are 5193available for use within the function body. 5194 5195.. |BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION`` 5196.. _BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION: 5197 5198``BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION(result, name)`` 5199--------------------------------------------------------- 5200 5201:Defined in: |preprocessor_no_spec_header|_ 5202 5203Generates a member function that can take in named arguments. 5204 5205:Example usage: 5206 5207When designing a front-end class template whose back-end is configurable via 5208parameterized inheritance, it can be useful to omit argument specifiers from 5209a named-parameter member function so that the delegate member functions of the 5210back-end classes can enforce their own specifications. 5211 5212.. parsed-literal:: 5213 5214 template <typename B> 5215 struct frontend : B 5216 { 5217 frontend() : B() 5218 { 5219 } 5220 5221 BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION((void), initialize) 5222 { 5223 this->initialize_impl(args); 5224 } 5225 }; 5226 5227Named parameters are required when invoking the member function; however, none 5228of their tags need to be in the same namespace. 5229 5230.. parsed-literal:: 5231 5232 |BOOST_PARAMETER_NAME|_\(a0) 5233 |BOOST_PARAMETER_NAME|_\(a1) 5234 |BOOST_PARAMETER_NAME|_\(a2) 5235 5236For this example, each of the back-end class templates requires its own 5237parameter to be present in the argument pack. In practice, such parameters 5238should be optional, with default values. 5239 5240.. parsed-literal:: 5241 5242 template <typename T> 5243 class backend0 5244 { 5245 T a0; 5246 5247 public: 5248 backend0() : a0() 5249 { 5250 } 5251 5252 T const& get_a0() const 5253 { 5254 return this->a0; 5255 } 5256 5257 protected: 5258 template <typename ArgPack> 5259 void initialize_impl(ArgPack const& args) 5260 { 5261 this->a0 = args[_a0]; 5262 } 5263 }; 5264 5265 template <typename B, typename T> 5266 class backend1 : public B 5267 { 5268 T a1; 5269 5270 public: 5271 backend1() : B(), a1() 5272 { 5273 } 5274 5275 T const& get_a1() const 5276 { 5277 return this->a1; 5278 } 5279 5280 protected: 5281 template <typename ArgPack> 5282 void initialize_impl(ArgPack const& args) 5283 { 5284 B::initialize_impl(args); 5285 this->a1 = args[_a1]; 5286 } 5287 }; 5288 5289 template <typename B, typename T> 5290 class backend2 : public B 5291 { 5292 T a2; 5293 5294 public: 5295 backend2() : B(), a2() 5296 { 5297 } 5298 5299 T const& get_a2() const 5300 { 5301 return this->a2; 5302 } 5303 5304 protected: 5305 template <typename ArgPack> 5306 void initialize_impl(ArgPack const& args) 5307 { 5308 B::initialize_impl(args); 5309 this->a2 = args[_a2]; 5310 } 5311 }; 5312 5313This example shows that while ``backend0`` must always be the root base class 5314template and that ``frontend`` must always be the most derived class template, 5315the other back-ends can be chained together in different orders. 5316 5317.. parsed-literal:: 5318 5319 char const* p = "foo"; 5320 frontend< 5321 backend2<backend1<backend0<char const*>, char>, int> 5322 > composed_obj0; 5323 frontend< 5324 backend1<backend2<backend0<char const*>, int>, char> 5325 > composed_obj1; 5326 composed_obj0.initialize(_a2 = 4, _a1 = ' ', _a0 = p); 5327 composed_obj1.initialize(_a0 = p, _a1 = ' ', _a2 = 4); 5328 BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0()); 5329 BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1()); 5330 BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2()); 5331 5332The |parameterized_inheritance_cpp|_ and |preproc_eval_cat_no_spec_cpp|_ test 5333programs demonstrate proper usage of this macro. 5334 5335**Macro parameters:** 5336 5337* ``result`` is the parenthesized return type of the function. 5338* ``name`` is the base name of the function; it determines the name of the 5339 generated implementation function. ``name`` may be qualified by the 5340 ``static`` keyword to declare the member function and its helpers as not 5341 associated with any object of the enclosing type. 5342 5343**Argument specifiers syntax:** 5344 5345None. 5346 5347**Approximate expansion:** 5348 5349.. parsed-literal:: 5350 5351 // If **result** is a template instantiation of |boost_enable_if|_\, 5352 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 5353 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 5354 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 5355 // |std_enable_if|_\: 5356 template <typename TaggedArg0, typename ...TaggedArgs> 5357 using boost_param_no_spec_result\_ ## __LINE__ ## **name** = **result**; 5358 5359 // If **result** is a simple return type: 5360 template <typename TaggedArg0, typename ...TaggedArgs> 5361 struct boost_param_no_spec_result\_ ## __LINE__ ## **name** 5362 { 5363 typedef **result** type; 5364 }; 5365 5366 template <typename TaggedArg0, typename ...TaggedArgs> 5367 inline typename |boost_lazy_enable_if|_\< 5368 |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...> 5369 , boost_param_no_spec_result\_ ## __LINE__ ## **name**\ < 5370 TaggedArg0 5371 , TaggedArgs... 5372 > 5373 >::type 5374 **name**\ (TaggedArg0 const& arg0, TaggedArgs const&... args) 5375 { 5376 return this->boost_param_no_spec_impl ## __LINE__ ## **name**\ ( 5377 static_cast< 5378 typename 5379 boost_param_no_spec_result\_ ## __LINE__ ## **name**\ < 5380 TaggedArg0 5381 , TaggedArgs... 5382 >::type(*)() 5383 >(|std_nullptr|_\) 5384 , |compose|_\(arg0, args...) 5385 ); 5386 } 5387 5388 template <typename ResultType, typename Args> 5389 ResultType 5390 boost_param_no_spec_impl ## __LINE__ ## **name**\ ( 5391 (ResultType(*)()) 5392 , Args const& args 5393 ) 5394 5395Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are 5396available for use within the function body. 5397 5398.. |BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION| replace:: ``BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION`` 5399.. _BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION: 5400 5401``BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION(result, name)`` 5402--------------------------------------------------------------- 5403 5404:Defined in: |preprocessor_no_spec_header|_ 5405 5406Generates a member function that can take in named arguments. 5407 5408:Example usage: 5409 5410The return type of each of the following function templates falls under a 5411different value category. 5412 5413.. parsed-literal:: 5414 5415 template <std::size_t N> 5416 |std_bitset|_\<N + 1> rvalue_bitset() 5417 { 5418 return |std_bitset|_\<N + 1>(); 5419 } 5420 5421 template <std::size_t N> 5422 |std_bitset|_\<N + 1> const rvalue_const_bitset() 5423 { 5424 return |std_bitset|_\<N + 1>(); 5425 } 5426 5427 template <std::size_t N> 5428 |std_bitset|_\<N + 1>& lvalue_bitset() 5429 { 5430 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 5431 return lset; 5432 } 5433 5434 template <std::size_t N> 5435 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 5436 { 5437 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 5438 return clset; 5439 } 5440 5441The ``U::evaluate_category`` static member function template has a simple job: 5442to return the correct value category when passed in an object returned by one 5443of the functions defined above. Assume that 5444|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 5445 5446.. parsed-literal:: 5447 5448 enum invoked 5449 { 5450 passed_by_lvalue_reference_to_const 5451 , passed_by_lvalue_reference 5452 , passed_by_rvalue_reference_to_const 5453 , passed_by_rvalue_reference 5454 }; 5455 5456 struct U 5457 { 5458 template <std::size_t N> 5459 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 5460 { 5461 return passed_by_lvalue_reference_to_const; 5462 } 5463 5464 template <std::size_t N> 5465 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 5466 { 5467 return passed_by_lvalue_reference; 5468 } 5469 5470 template <std::size_t N> 5471 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 5472 { 5473 return passed_by_rvalue_reference_to_const; 5474 } 5475 5476 template <std::size_t N> 5477 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 5478 { 5479 return passed_by_rvalue_reference; 5480 } 5481 }; 5482 5483Named parameters are required when invoking the member function; however, none 5484of their tags need to be in the same namespace. 5485 5486.. parsed-literal:: 5487 5488 |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc)) 5489 |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr)) 5490 |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc)) 5491 |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr)) 5492 5493Use the macro as a substitute for a variadic function header. Enclose the 5494return type ``bool`` in parentheses. The macro will qualify the function with 5495the ``const`` keyword. 5496 5497.. parsed-literal:: 5498 5499 struct D 5500 { 5501 D() 5502 { 5503 } 5504 5505 BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION((bool), evaluate_m) 5506 { 5507 BOOST_TEST_EQ( 5508 passed_by_lvalue_reference_to_const 5509 , U::evaluate_category<0>(args[_lrc]) 5510 ); 5511 BOOST_TEST_EQ( 5512 passed_by_lvalue_reference 5513 , U::evaluate_category<1>(args[_lr]) 5514 ); 5515 BOOST_TEST_EQ( 5516 passed_by_rvalue_reference_to_const 5517 , U::evaluate_category<2>( 5518 args[_rrc | rvalue_const_bitset<2>()] 5519 ) 5520 ); 5521 BOOST_TEST_EQ( 5522 passed_by_rvalue_reference 5523 , U::evaluate_category<3>( 5524 args[_rr | rvalue_bitset<3>()] 5525 ) 5526 ); 5527 5528 return true; 5529 } 5530 }; 5531 5532To invoke the member function, bind all its arguments to named parameters. 5533 5534.. parsed-literal:: 5535 5536 D const d = D(); 5537 d.evaluate_m( 5538 _rr0 = rvalue_bitset<3>() 5539 , _lrc0 = lvalue_const_bitset<0>() 5540 , _lr0 = lvalue_bitset<1>() 5541 , _rrc0 = rvalue_const_bitset<2>() 5542 ); 5543 d.evaluate_m( 5544 _lr0 = lvalue_bitset<1>() 5545 , _lrc0 = lvalue_const_bitset<0>() 5546 ); 5547 5548The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of 5549this macro. 5550 5551**Macro parameters:** 5552 5553* ``result`` is the parenthesized return type of the function. 5554* ``name`` is the base name of the function; it determines the name of the 5555 generated implementation function. 5556 5557**Argument specifiers syntax:** 5558 5559None. 5560 5561**Approximate expansion:** 5562 5563.. parsed-literal:: 5564 5565 // If **result** is a template instantiation of |boost_enable_if|_\, 5566 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 5567 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 5568 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 5569 // |std_enable_if|_\: 5570 template <typename TaggedArg0, typename ...TaggedArgs> 5571 using boost_param_no_spec_result_const\_ ## __LINE__ ## **name** = **result**; 5572 5573 // If **result** is a simple return type: 5574 template <typename TaggedArg0, typename ...TaggedArgs> 5575 struct boost_param_no_spec_result_const\_ ## __LINE__ ## **name** 5576 { 5577 typedef **result** type; 5578 }; 5579 5580 template <typename TaggedArg0, typename ...TaggedArgs> 5581 inline typename |boost_lazy_enable_if|_\< 5582 |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...> 5583 , boost_param_no_spec_result_const\_ ## __LINE__ ## **name**\ < 5584 TaggedArg0 5585 , TaggedArgs... 5586 > 5587 >::type 5588 **name**\ (TaggedArg0 const& arg0, TaggedArgs const&... args) const 5589 { 5590 return this->boost_param_no_spec_impl_const ## __LINE__ ## **name**\ ( 5591 static_cast< 5592 typename 5593 boost_param_no_spec_result_const\_ ## __LINE__ ## **name**\ < 5594 TaggedArg0 5595 , TaggedArgs... 5596 >::type(*)() 5597 >(|std_nullptr|_\) 5598 , |compose|_\(arg0, args...) 5599 ); 5600 } 5601 5602 template <typename ResultType, typename Args> 5603 ResultType 5604 boost_param_no_spec_impl_const ## __LINE__ ## **name**\ ( 5605 (ResultType(*)()) 5606 , Args const& args 5607 ) const 5608 5609Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are 5610available for use within the function body. 5611 5612.. |BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR`` 5613.. _BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR: 5614 5615``BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR(result)`` 5616---------------------------------------------------------- 5617 5618:Defined in: |preprocessor_no_spec_header|_ 5619 5620Generates a function call operator that can take in named arguments. 5621 5622:Example usage: 5623 5624When designing a front-end class template whose back-end is configurable via 5625parameterized inheritance, it can be useful to omit argument specifiers from 5626a named-parameter function call operator so that the delegate member functions 5627of the back-end classes can enforce their own specifications. 5628 5629.. parsed-literal:: 5630 5631 template <typename B> 5632 struct frontend : B 5633 { 5634 frontend() : B() 5635 { 5636 } 5637 5638 BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR((void)) 5639 { 5640 this->initialize_impl(args); 5641 } 5642 }; 5643 5644Named parameters are required when invoking the function call operator; 5645however, none of their tags need to be in the same namespace. 5646 5647.. parsed-literal:: 5648 5649 |BOOST_PARAMETER_NAME|_\(a0) 5650 |BOOST_PARAMETER_NAME|_\(a1) 5651 |BOOST_PARAMETER_NAME|_\(a2) 5652 5653For this example, each of the back-end class templates requires its own 5654parameter to be present in the argument pack. In practice, such parameters 5655should be optional, with default values. 5656 5657.. parsed-literal:: 5658 5659 template <typename T> 5660 class backend0 5661 { 5662 T a0; 5663 5664 public: 5665 backend0() : a0() 5666 { 5667 } 5668 5669 T const& get_a0() const 5670 { 5671 return this->a0; 5672 } 5673 5674 protected: 5675 template <typename ArgPack> 5676 void initialize_impl(ArgPack const& args) 5677 { 5678 this->a0 = args[_a0]; 5679 } 5680 }; 5681 5682 template <typename B, typename T> 5683 class backend1 : public B 5684 { 5685 T a1; 5686 5687 public: 5688 backend1() : B(), a1() 5689 { 5690 } 5691 5692 T const& get_a1() const 5693 { 5694 return this->a1; 5695 } 5696 5697 protected: 5698 template <typename ArgPack> 5699 void initialize_impl(ArgPack const& args) 5700 { 5701 B::initialize_impl(args); 5702 this->a1 = args[_a1]; 5703 } 5704 }; 5705 5706 template <typename B, typename T> 5707 class backend2 : public B 5708 { 5709 T a2; 5710 5711 public: 5712 backend2() : B(), a2() 5713 { 5714 } 5715 5716 T const& get_a2() const 5717 { 5718 return this->a2; 5719 } 5720 5721 protected: 5722 template <typename ArgPack> 5723 void initialize_impl(ArgPack const& args) 5724 { 5725 B::initialize_impl(args); 5726 this->a2 = args[_a2]; 5727 } 5728 }; 5729 5730This example shows that while ``backend0`` must always be the root base class 5731template and that ``frontend`` must always be the most derived class template, 5732the other back-ends can be chained together in different orders. 5733 5734.. parsed-literal:: 5735 5736 char const* p = "foo"; 5737 frontend< 5738 backend2<backend1<backend0<char const*>, char>, int> 5739 > composed_obj0; 5740 frontend< 5741 backend1<backend2<backend0<char const*>, int>, char> 5742 > composed_obj1; 5743 composed_obj0(_a2 = 4, _a1 = ' ', _a0 = p); 5744 composed_obj1(_a0 = p, _a1 = ' ', _a2 = 4); 5745 BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0()); 5746 BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1()); 5747 BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2()); 5748 5749The |parameterized_inheritance_cpp|_ and |preproc_eval_cat_no_spec_cpp|_ test 5750programs demonstrate proper usage of this macro. 5751 5752**Macro parameters:** 5753 5754* ``result`` is the parenthesized return type of the function call operator. 5755 5756**Argument specifiers syntax:** 5757 5758None. 5759 5760**Approximate expansion:** 5761 5762.. parsed-literal:: 5763 5764 // If **result** is a template instantiation of |boost_enable_if|_\, 5765 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 5766 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 5767 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 5768 // |std_enable_if|_\: 5769 template <typename TaggedArg0, typename ...TaggedArgs> 5770 using boost_param_no_spec_result\_ ## __LINE__ ## operator = **result**; 5771 5772 // If **result** is a simple return type: 5773 template <typename TaggedArg0, typename ...TaggedArgs> 5774 struct boost_param_no_spec_result\_ ## __LINE__ ## operator 5775 { 5776 typedef **result** type; 5777 }; 5778 5779 template <typename TaggedArg0, typename ...TaggedArgs> 5780 inline typename |boost_lazy_enable_if|_\< 5781 |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...> 5782 , boost_param_no_spec_result\_ ## __LINE__ ## operator< 5783 TaggedArg0 5784 , TaggedArgs... 5785 > 5786 >::type 5787 operator()(TaggedArg0 const& arg0, TaggedArgs const&... args) 5788 { 5789 return this->boost_param_no_spec_impl ## __LINE__ ## operator( 5790 static_cast< 5791 typename 5792 boost_param_no_spec_result\_ ## __LINE__ ## operator< 5793 TaggedArg0 5794 , TaggedArgs... 5795 >::type(*)() 5796 >(|std_nullptr|_\) 5797 , |compose|_\(arg0, args...) 5798 ); 5799 } 5800 5801 template <typename ResultType, typename Args> 5802 ResultType 5803 boost_param_no_spec_impl ## __LINE__ ## operator( 5804 (ResultType(*)()) 5805 , Args const& args 5806 ) 5807 5808Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are 5809available for use within the function body. 5810 5811.. |BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR| replace:: ``BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR`` 5812.. _BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR: 5813 5814``BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR(result)`` 5815---------------------------------------------------------------- 5816 5817:Defined in: |preprocessor_no_spec_header|_ 5818 5819Generates a function call operator that can take in named arguments. 5820 5821:Example usage: 5822 5823The return type of each of the following function templates falls under a 5824different value category. 5825 5826.. parsed-literal:: 5827 5828 template <std::size_t N> 5829 |std_bitset|_\<N + 1> rvalue_bitset() 5830 { 5831 return |std_bitset|_\<N + 1>(); 5832 } 5833 5834 template <std::size_t N> 5835 |std_bitset|_\<N + 1> const rvalue_const_bitset() 5836 { 5837 return |std_bitset|_\<N + 1>(); 5838 } 5839 5840 template <std::size_t N> 5841 |std_bitset|_\<N + 1>& lvalue_bitset() 5842 { 5843 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 5844 return lset; 5845 } 5846 5847 template <std::size_t N> 5848 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 5849 { 5850 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 5851 return clset; 5852 } 5853 5854The ``U::evaluate_category`` static member function template has a simple job: 5855to return the correct value category when passed in an object returned by one 5856of the functions defined above. Assume that 5857|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 5858 5859.. parsed-literal:: 5860 5861 enum invoked 5862 { 5863 passed_by_lvalue_reference_to_const 5864 , passed_by_lvalue_reference 5865 , passed_by_rvalue_reference_to_const 5866 , passed_by_rvalue_reference 5867 }; 5868 5869 struct U 5870 { 5871 template <std::size_t N> 5872 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 5873 { 5874 return passed_by_lvalue_reference_to_const; 5875 } 5876 5877 template <std::size_t N> 5878 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 5879 { 5880 return passed_by_lvalue_reference; 5881 } 5882 5883 template <std::size_t N> 5884 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 5885 { 5886 return passed_by_rvalue_reference_to_const; 5887 } 5888 5889 template <std::size_t N> 5890 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 5891 { 5892 return passed_by_rvalue_reference; 5893 } 5894 }; 5895 5896Named parameters are required when invoking the function call operator; 5897however, none of their tags need to be in the same namespace. 5898 5899.. parsed-literal:: 5900 5901 |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc)) 5902 |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr)) 5903 |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc)) 5904 |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr)) 5905 5906Use the macro as a substitute for a variadic function call operator 5907header. Enclose the return type ``bool`` in parentheses. The macro will 5908qualify the function with the ``const`` keyword. 5909 5910.. parsed-literal:: 5911 5912 struct D 5913 { 5914 D() 5915 { 5916 } 5917 5918 BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR((bool)) 5919 { 5920 BOOST_TEST_EQ( 5921 passed_by_lvalue_reference_to_const 5922 , U::evaluate_category<0>(args[_lrc]) 5923 ); 5924 BOOST_TEST_EQ( 5925 passed_by_lvalue_reference 5926 , U::evaluate_category<1>(args[_lr]) 5927 ); 5928 BOOST_TEST_EQ( 5929 passed_by_rvalue_reference_to_const 5930 , U::evaluate_category<2>( 5931 args[_rrc | rvalue_const_bitset<2>()] 5932 ) 5933 ); 5934 BOOST_TEST_EQ( 5935 passed_by_rvalue_reference 5936 , U::evaluate_category<3>( 5937 args[_rr | rvalue_bitset<3>()] 5938 ) 5939 ); 5940 5941 return true; 5942 } 5943 }; 5944 5945To invoke the function call operator, bind all its arguments to named 5946parameters. 5947 5948.. parsed-literal:: 5949 5950 D const d = D(); 5951 d( 5952 _rr0 = rvalue_bitset<3>() 5953 , _lrc0 = lvalue_const_bitset<0>() 5954 , _lr0 = lvalue_bitset<1>() 5955 , _rrc0 = rvalue_const_bitset<2>() 5956 ); 5957 d( 5958 _lr0 = lvalue_bitset<1>() 5959 , _lrc0 = lvalue_const_bitset<0>() 5960 ); 5961 5962The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of this 5963macro. 5964 5965**Macro parameters:** 5966 5967* ``result`` is the parenthesized return type of the function call operator. 5968 5969**Argument specifiers syntax:** 5970 5971None. 5972 5973**Approximate expansion:** 5974 5975.. parsed-literal:: 5976 5977 // If **result** is a template instantiation of |boost_enable_if|_\, 5978 // |boost_enable_if_c|_\, |boost_lazy_enable_if|_\, 5979 // |boost_lazy_enable_if_c|_\, |boost_disable_if|_\, |boost_disable_if_c|_\, 5980 // |boost_lazy_disable_if|_\, |boost_lazy_disable_if_c|_\, or 5981 // |std_enable_if|_\: 5982 template <typename TaggedArg0, typename ...TaggedArgs> 5983 using boost_param_no_spec_result_const\_ ## __LINE__ ## operator = **result**; 5984 5985 // If **result** is a simple return type: 5986 template <typename TaggedArg0, typename ...TaggedArgs> 5987 struct boost_param_no_spec_result_const\_ ## __LINE__ ## operator 5988 { 5989 typedef **result** type; 5990 }; 5991 5992 template <typename TaggedArg0, typename ...TaggedArgs> 5993 inline typename |boost_lazy_enable_if|_\< 5994 |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...> 5995 , boost_param_no_spec_result_const\_ ## __LINE__ ## operator< 5996 TaggedArg0 5997 , TaggedArgs... 5998 > 5999 >::type 6000 operator()( 6001 TaggedArg0 const& arg0 6002 , TaggedArgs const&... args 6003 ) const 6004 { 6005 return this->boost_param_no_spec_impl_const ## __LINE__ ## operator( 6006 static_cast< 6007 typename 6008 boost_param_no_spec_result_const\_ ## __LINE__ ## operator< 6009 TaggedArg0 6010 , TaggedArgs... 6011 >::type(*)() 6012 >(|std_nullptr|_\) 6013 , |compose|_\(arg0, args...) 6014 ); 6015 } 6016 6017 template <typename ResultType, typename Args> 6018 ResultType 6019 boost_param_no_spec_impl_const ## __LINE__ ## operator( 6020 (ResultType(*)()) 6021 , Args const& args 6022 ) const 6023 6024Only the |ArgumentPack|_ type ``Args`` and its object instance ``args`` are 6025available for use within the function body. 6026 6027.. |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR| replace:: ``BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR`` 6028.. _BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR: 6029 6030``BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(cls, impl)`` 6031-------------------------------------------------- 6032 6033:Defined in: |preprocessor_no_spec_header|_ 6034 6035Generates a constructor that can take in named arguments. 6036 6037:Example usage: 6038 6039When designing a front-end class template whose back-end is configurable via 6040parameterized inheritance, it can be useful to omit argument specifiers from 6041a named-parameter constructor so that the delegate constructors of the 6042back-end classes can enforce their own specifications. 6043 6044.. parsed-literal:: 6045 6046 template <typename B> 6047 struct frontend : B 6048 { 6049 BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR(frontend, (B)) 6050 }; 6051 6052Named parameters are required when invoking the constructor; however, none of 6053their tags need to be in the same namespace. 6054 6055.. parsed-literal:: 6056 6057 |BOOST_PARAMETER_NAME|_\(a0) 6058 |BOOST_PARAMETER_NAME|_\(a1) 6059 |BOOST_PARAMETER_NAME|_\(a2) 6060 6061For this example, each of the back-end class templates requires its own 6062parameter to be present in the argument pack. In practice, such parameters 6063should be optional, with default values. 6064 6065.. parsed-literal:: 6066 6067 struct _enabler 6068 { 6069 }; 6070 6071 template <typename T> 6072 class backend0 6073 { 6074 T a0; 6075 6076 public: 6077 template <typename ArgPack> 6078 explicit backend0( 6079 ArgPack const& args 6080 , typename |boost_enable_if|_\< 6081 |is_argument_pack|_\<ArgPack> 6082 , _enabler 6083 >::type = _enabler() 6084 ) : a0(args[_a0]) 6085 { 6086 } 6087 6088 T const& get_a0() const 6089 { 6090 return this->a0; 6091 } 6092 }; 6093 6094 template <typename B, typename T> 6095 class backend1 : public B 6096 { 6097 T a1; 6098 6099 public: 6100 template <typename ArgPack> 6101 explicit backend1( 6102 ArgPack const& args 6103 , typename |boost_enable_if|_\< 6104 |is_argument_pack|_\<ArgPack> 6105 , _enabler 6106 >::type = _enabler() 6107 ) : B(args), a1(args[_a1]) 6108 { 6109 } 6110 6111 T const& get_a1() const 6112 { 6113 return this->a1; 6114 } 6115 }; 6116 6117 template <typename B, typename T> 6118 class backend2 : public B 6119 { 6120 T a2; 6121 6122 public: 6123 template <typename ArgPack> 6124 explicit backend2( 6125 ArgPack const& args 6126 , typename |boost_enable_if|_\< 6127 |is_argument_pack|_\<ArgPack> 6128 , _enabler 6129 >::type = _enabler() 6130 ) : B(args), a2(args[_a2]) 6131 { 6132 } 6133 6134 T const& get_a2() const 6135 { 6136 return this->a2; 6137 } 6138 }; 6139 6140This example shows that while ``backend0`` must always be the root base class 6141template and that ``frontend`` must always be the most derived class template, 6142the other back-ends can be chained together in different orders. 6143 6144.. parsed-literal:: 6145 6146 char const* p = "foo"; 6147 frontend< 6148 backend2<backend1<backend0<char const*>, char>, int> 6149 > composed_obj0(_a2 = 4, _a1 = ' ', _a0 = p); 6150 frontend< 6151 backend1<backend2<backend0<char const*>, int>, char> 6152 > composed_obj1(_a0 = p, _a1 = ' ', _a2 = 4); 6153 BOOST_TEST_EQ(composed_obj0.get_a0(), composed_obj1.get_a0()); 6154 BOOST_TEST_EQ(composed_obj0.get_a1(), composed_obj1.get_a1()); 6155 BOOST_TEST_EQ(composed_obj0.get_a2(), composed_obj1.get_a2()); 6156 6157The |parameterized_inheritance_cpp|_ and |preproc_eval_cat_no_spec_cpp|_ test 6158programs demonstrate proper usage of this macro. 6159 6160**Macro parameters:** 6161 6162* ``cls`` is the name of the enclosing class. 6163* ``impl`` is the parenthesized implementation base class for ``cls``. 6164 6165**Argument specifiers syntax:** 6166 6167None. 6168 6169**Approximate expansion:** 6170 6171.. parsed-literal:: 6172 6173 template < 6174 typename TaggedArg0 6175 , typename ...TaggedArgs 6176 , typename = typename |boost_enable_if|_\< 6177 |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...> 6178 >::type 6179 > 6180 inline explicit **cls**\ ( 6181 TaggedArg0 const& arg0 6182 , TaggedArgs const&... args 6183 ) : **impl**\ (|compose|_\(arg0, args...)) 6184 { 6185 } 6186 6187.. |BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR| replace:: ``BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR`` 6188.. _BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR: 6189 6190``BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(cls, impl)`` 6191---------------------------------------------------------- 6192 6193:Defined in: |preprocessor_no_spec_header|_ 6194 6195Generates a constructor that can take in named arguments. 6196 6197:Example usage: 6198 6199The return type of each of the following function templates falls under a 6200different value category. 6201 6202.. parsed-literal:: 6203 6204 template <std::size_t N> 6205 |std_bitset|_\<N + 1> rvalue_bitset() 6206 { 6207 return |std_bitset|_\<N + 1>(); 6208 } 6209 6210 template <std::size_t N> 6211 |std_bitset|_\<N + 1> const rvalue_const_bitset() 6212 { 6213 return |std_bitset|_\<N + 1>(); 6214 } 6215 6216 template <std::size_t N> 6217 |std_bitset|_\<N + 1>& lvalue_bitset() 6218 { 6219 static |std_bitset|_\<N + 1> lset = |std_bitset|_\<N + 1>(); 6220 return lset; 6221 } 6222 6223 template <std::size_t N> 6224 |std_bitset|_\<N + 1> const& lvalue_const_bitset() 6225 { 6226 static |std_bitset|_\<N + 1> const clset = |std_bitset|_\<N + 1>(); 6227 return clset; 6228 } 6229 6230The ``U::evaluate_category`` static member function template has a simple job: 6231to return the correct value category when passed in an object returned by one 6232of the functions defined above. Assume that 6233|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined. 6234 6235.. parsed-literal:: 6236 6237 enum invoked 6238 { 6239 passed_by_lvalue_reference_to_const 6240 , passed_by_lvalue_reference 6241 , passed_by_rvalue_reference_to_const 6242 , passed_by_rvalue_reference 6243 }; 6244 6245 struct U 6246 { 6247 template <std::size_t N> 6248 static invoked evaluate_category(|std_bitset|_\<N + 1> const&) 6249 { 6250 return passed_by_lvalue_reference_to_const; 6251 } 6252 6253 template <std::size_t N> 6254 static invoked evaluate_category(|std_bitset|_\<N + 1>&) 6255 { 6256 return passed_by_lvalue_reference; 6257 } 6258 6259 template <std::size_t N> 6260 static invoked evaluate_category(|std_bitset|_\<N + 1> const&&) 6261 { 6262 return passed_by_rvalue_reference_to_const; 6263 } 6264 6265 template <std::size_t N> 6266 static invoked evaluate_category(|std_bitset|_\<N + 1>&&) 6267 { 6268 return passed_by_rvalue_reference; 6269 } 6270 }; 6271 6272Named parameters are required when invoking the constructor; however, none of 6273their tags need to be in the same namespace. 6274 6275.. parsed-literal:: 6276 6277 |BOOST_PARAMETER_NAME|_\((_lrc, kw0) in(lrc)) 6278 |BOOST_PARAMETER_NAME|_\((_lr, kw1) in_out(lr)) 6279 |BOOST_PARAMETER_NAME|_\((_rrc, kw2) in(rrc)) 6280 |BOOST_PARAMETER_NAME|_\((_rr, kw3) consume(rr)) 6281 6282Unlike |BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_, this macro doesn't require a 6283base class, only a delegate function to which the generated constructor can 6284pass its |ArgumentPack|_. 6285 6286.. parsed-literal:: 6287 6288 struct D 6289 { 6290 BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR(D, D::_evaluate) 6291 6292 private: 6293 template <typename Args> 6294 static bool _evaluate(Args const& args) 6295 { 6296 BOOST_TEST_EQ( 6297 passed_by_lvalue_reference_to_const 6298 , U::evaluate_category<0>(args[_lrc]) 6299 ); 6300 BOOST_TEST_EQ( 6301 passed_by_lvalue_reference 6302 , U::evaluate_category<1>(args[_lr]) 6303 ); 6304 BOOST_TEST_EQ( 6305 passed_by_rvalue_reference_to_const 6306 , U::evaluate_category<2>( 6307 args[_rrc | rvalue_const_bitset<2>()] 6308 ) 6309 ); 6310 BOOST_TEST_EQ( 6311 passed_by_rvalue_reference 6312 , U::evaluate_category<3>( 6313 args[_rr | rvalue_bitset<3>()] 6314 ) 6315 ); 6316 6317 return true; 6318 } 6319 }; 6320 6321To invoke the constructor, bind all its arguments to named parameters. 6322 6323.. parsed-literal:: 6324 6325 D dp0( 6326 _rr0 = rvalue_bitset<3>() 6327 , _lrc0 = lvalue_const_bitset<0>() 6328 , _lr0 = lvalue_bitset<1>() 6329 , _rrc0 = rvalue_const_bitset<2>() 6330 ); 6331 D dp1( 6332 _lr0 = lvalue_bitset<1>() 6333 , _lrc0 = lvalue_const_bitset<0>() 6334 ); 6335 6336The |preproc_eval_cat_no_spec_cpp|_ test program demonstrates proper usage of 6337this macro. 6338 6339**Macro parameters:** 6340 6341* ``cls`` is the name of the enclosing class. 6342* ``func`` is a function that takes in the |ArgumentPack|_ that the 6343 generated constructor passes on. 6344 6345**Argument specifiers syntax:** 6346 6347None. 6348 6349**Approximate expansion:** 6350 6351.. parsed-literal:: 6352 6353 template < 6354 typename TaggedArg0 6355 , typename ...TaggedArgs 6356 , typename = typename |boost_enable_if|_\< 6357 |are_tagged_arguments|_\<TaggedArg0,TaggedArgs...> 6358 >::type 6359 > 6360 inline explicit **cls**\ ( 6361 TaggedArg0 const& arg0 6362 , TaggedArgs const&... args 6363 ) 6364 { 6365 **func**\ (|compose|_\(arg0, args...)); 6366 } 6367 6368.. |BOOST_PARAMETER_NAME| replace:: ``BOOST_PARAMETER_NAME`` 6369.. _BOOST_PARAMETER_NAME: 6370 6371``BOOST_PARAMETER_NAME(name)`` 6372------------------------------ 6373 6374:Defined in: |name_header|_ 6375 6376Declares a tag-type and keyword object. 6377 6378**If** *name* is of the form: 6379 6380.. parsed-literal:: 6381 6382 (*object-name*, *namespace-name*) *qualifier*\ (*tag-name*) 6383 6384**then** 6385 6386:Requires: *qualifier* is either ``in``, ``out``, ``in_out``, ``consume``, 6387 ``move_from``, or ``forward``. 6388:Expands to: 6389 6390.. parsed-literal:: 6391 6392 namespace *namespace-name* { 6393 6394 struct *tag-name* 6395 { 6396 static constexpr char const* keyword_name() 6397 { 6398 return ## *tag-name*; 6399 } 6400 6401 typedef *unspecified* _; 6402 typedef *unspecified* _1; 6403 typedef boost::parameter::*qualifier* ## _reference qualifier; 6404 6405 // The following definitions are available only when 6406 // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined. 6407 6408 template <typename ArgumentPack> 6409 using binding_fn = typename |binding|_\< 6410 ArgumentPack 6411 , *tag-name* 6412 >::type; 6413 6414 template <typename ArgumentPack> 6415 using fn = typename |value_type|_\<ArgumentPack, *tag-name*>::type; 6416 }; 6417 } 6418 6419 |keyword|_\<*tag-namespace*::*tag-name*> const& *object-name* 6420 = |keyword|_\<*tag-namespace*::*tag-name*>::instance; 6421 6422**Else If** *name* is of the form: 6423 6424.. parsed-literal:: 6425 6426 (*tag-name*, *namespace-name*) *object-name* 6427 6428**then** 6429 6430Treats *name* as if it were of the form: 6431 6432.. parsed-literal:: 6433 6434 (forward(*tag-name*), *namespace-name*) *object-name* 6435 6436**Else If** *name* is of the form: 6437 6438.. parsed-literal:: 6439 6440 *qualifier*\ (*tag-name*) 6441 6442**then** 6443 6444:Requires: *qualifier* is either ``in``, ``out``, ``in_out``, ``consume``, 6445 ``move_from``, or ``forward``. 6446:Expands to: 6447 6448.. parsed-literal:: 6449 6450 namespace tag { 6451 6452 struct *tag-name* 6453 { 6454 static constexpr char const* keyword_name() 6455 { 6456 return ## *tag-name*; 6457 } 6458 6459 typedef *unspecified* _; 6460 typedef *unspecified* _1; 6461 typedef boost::parameter::*qualifier* ## _reference qualifier; 6462 6463 // The following definitions are available only when 6464 // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined. 6465 6466 template <typename ArgumentPack> 6467 using binding_fn = typename |binding|_\< 6468 ArgumentPack 6469 , *tag-name* 6470 >::type; 6471 6472 template <typename ArgumentPack> 6473 using fn = typename |value_type|_\<ArgumentPack, *tag-name*>::type; 6474 }; 6475 } 6476 6477 |keyword|_\<tag::*tag-name*> const& _ ## *tag-name* 6478 = |keyword|_\<tag::*tag-name*>::instance; 6479 6480**Else** 6481 6482Treats *name* as if it were of the form: 6483 6484.. parsed-literal:: 6485 6486 forward(*tag-name*) 6487 6488.. |BOOST_PARAMETER_NESTED_KEYWORD| replace:: ``BOOST_PARAMETER_NESTED_KEYWORD`` 6489.. _BOOST_PARAMETER_NESTED_KEYWORD: 6490 6491``BOOST_PARAMETER_NESTED_KEYWORD(tag_namespace, name, alias)`` 6492-------------------------------------------------------------- 6493 6494:Defined in: |nested_keyword_header|_ 6495 6496Declares a tag-type, a keyword object, and an alias for that object nested in 6497the tag-type. 6498 6499**If** *name* is of the form: 6500 6501.. parsed-literal:: 6502 6503 *qualifier*\ (*tag-name*) 6504 6505**then** 6506 6507:Requires: *qualifier* is either ``in``, ``out``, ``in_out``, ``consume``, 6508 ``move_from``, or ``forward``. 6509 6510:Expands to: 6511 6512.. parsed-literal:: 6513 6514 namespace tag { 6515 6516 struct *tag-name* 6517 { 6518 static constexpr char const* keyword_name() 6519 { 6520 return ## *tag-name* ## _; 6521 } 6522 6523 typedef *unspecified* _; 6524 typedef *unspecified* _1; 6525 typedef boost::parameter::*qualifier* ## _reference qualifier; 6526 static |keyword|_\<*tag-name*> const& *alias*; 6527 6528 // The following definitions are available only when 6529 // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined. 6530 6531 template <typename ArgumentPack> 6532 using binding_fn = typename |binding|_\< 6533 ArgumentPack 6534 , *tag-name* 6535 >::type; 6536 6537 template <typename ArgumentPack> 6538 using fn = typename |value_type|_\<ArgumentPack, *tag-name*>::type; 6539 }; 6540 6541 |keyword|_\<*tag-name*> const& tag::*tag-name*::*alias* 6542 = |keyword|_\<*tag-name*>::instance; 6543 } 6544 6545 |keyword|_\<tag::*tag-name*> const& tag::*tag-name*::*name* 6546 = |keyword|_\<tag::*tag-name*>::instance; 6547 6548**Else** 6549 6550Treats *name* as if it were of the form: 6551 6552.. parsed-literal:: 6553 6554 forward(*tag-name*) 6555 6556.. |BOOST_PARAMETER_TEMPLATE_KEYWORD| replace:: ``BOOST_PARAMETER_TEMPLATE_KEYWORD`` 6557.. _BOOST_PARAMETER_TEMPLATE_KEYWORD: 6558 6559``BOOST_PARAMETER_TEMPLATE_KEYWORD(name)`` 6560------------------------------------------ 6561 6562:Defined in: |template_keyword_header|_ 6563:Included by: |name_header|_ 6564:Expands to: 6565 6566.. parsed-literal:: 6567 6568 namespace tag { 6569 6570 struct *name*; 6571 } 6572 6573 template <typename T> 6574 struct *name* : |template_keyword|_\<tag:: *name*, T> 6575 { 6576 }; 6577 6578The |function_type_tpl_param_cpp|_ test program demonstrates proper usage of 6579this macro. 6580 6581.. |BOOST_PARAMETER_FUN| replace:: ``BOOST_PARAMETER_FUN`` 6582.. _BOOST_PARAMETER_FUN: 6583 6584``BOOST_PARAMETER_FUN(r, n, l, h, p)`` 6585-------------------------------------- 6586 6587.. admonition:: Deprecated 6588 6589 This macro has been deprecated in favor of 6590 ``BOOST_PARAMETER_FUNCTION``. 6591 6592Generates a sequence of `forwarding function`_ templates named 6593``n``, with arities ranging from ``l`` to ``h``, returning ``r``, 6594and using ``p`` to control overload resolution and assign tags to 6595positional arguments. 6596 6597:Defined in: |macros_header|_ 6598:Requires: ``l`` and ``h`` are nonnegative integer tokens 6599 such that ``l`` < ``h`` 6600:Expands to: 6601 6602.. parsed-literal:: 6603 6604 template <typename A1, typename A2, …, typename A ## **l**> 6605 r 6606 name( 6607 A1 && a1, A2 && a2, …, A ## **l** && a ## **l** 6608 , typename **p**::match<A1, A2, …, A ## **l**>::type p = **p**\ () 6609 ) 6610 { 6611 return **name**\ _with_named_params( 6612 **p**\ ( 6613 |std_forward|_\<A1>(a1) 6614 , |std_forward|_\<A2>(a2) 6615 , … 6616 , |std_forward|_\<A ## **l**>(a ## **l**) 6617 ) 6618 ); 6619 } 6620 6621 template < 6622 typename A1 6623 , typename A2 6624 , … 6625 , typename A ## **l** 6626 , typename A ## |BOOST_PP_INC|_\ (**l**) 6627 > 6628 r 6629 name( 6630 A1 && a1, A2 && a2, …, A ## **l** && a ## **l** 6631 , A ## |BOOST_PP_INC|_\ (**l**) const& a ## |BOOST_PP_INC|_\ (**l**) 6632 , typename **p**::match< 6633 A1, A2, …, A ## **l**, A ## |BOOST_PP_INC|_\ (**l**) 6634 >::type p = **p**\ () 6635 ) 6636 { 6637 return **name**\ _with_named_params( 6638 **p**\ ( 6639 |std_forward|_\<A1>(a1) 6640 , |std_forward|_\<A2>(a2) 6641 , … 6642 , |std_forward|_\<A ## **l**>(a ## **l**) 6643 , |std_forward|_\<A ## |BOOST_PP_INC|_\ (**l**)>( 6644 a ## |BOOST_PP_INC|_\ (**l**) 6645 ) 6646 ) 6647 ); 6648 } 6649 6650 :vellipsis:`⋮` 6651 6652 template <typename A1, typename A2, …, typename A ## **h**> 6653 r 6654 name( 6655 A1 && a1, A2 && a2, …, A ## **h** && x ## **h** 6656 , typename **p**::match<A1, A2, …, A ## **h**>::type p = **p**\ () 6657 ) 6658 { 6659 return **name**\ _with_named_params( 6660 **p**\ ( 6661 |std_forward|_\<A1>(a1) 6662 , |std_forward|_\<A2>(a2) 6663 , … 6664 , |std_forward|_\<A ## **h**>(a ## **h**) 6665 ) 6666 ); 6667 } 6668 6669The |macros_cpp|_ and |macros_eval_cat_cpp|_ test programs demonstrate proper 6670usage of this macro. 6671 6672.. |BOOST_PARAMETER_KEYWORD| replace:: ``BOOST_PARAMETER_KEYWORD`` 6673.. _BOOST_PARAMETER_KEYWORD: 6674 6675``BOOST_PARAMETER_KEYWORD(n, k)`` 6676--------------------------------- 6677 6678.. admonition:: Deprecated 6679 6680 This macro has been deprecated in favor of 6681 ``BOOST_PARAMETER_NAME``. 6682 6683Generates the declaration of a |keyword tag type| named ``k`` in 6684namespace ``n`` and a corresponding |keyword object| definition in 6685the enclosing namespace. 6686 6687:Defined in: |keyword_header|_ 6688:Expands to: 6689 6690.. parsed-literal:: 6691 6692 namespace **n** { 6693 6694 struct **k** 6695 { 6696 static constexpr char const* keyword_name() 6697 { 6698 return ## *k*; 6699 } 6700 6701 typedef *unspecified* _; 6702 typedef *unspecified* _1; 6703 typedef boost::parameter::forward_reference qualifier; 6704 6705 // The following definitions are available only when 6706 // |BOOST_PARAMETER_CAN_USE_MP11|_ is defined. 6707 6708 template <typename ArgumentPack> 6709 using binding_fn = typename |binding|_\< 6710 ArgumentPack 6711 , *k* 6712 >::type; 6713 6714 template <typename ArgumentPack> 6715 using fn = typename |value_type|_\<ArgumentPack, *k*>::type; 6716 }; 6717 } 6718 6719 namespace { 6720 6721 |keyword|_\<*n*::**k**> const& **k** 6722 = |keyword|_\<*n*::**k**>::instance; 6723 } 6724 6725``BOOST_PARAMETER_MATCH(p, a, x)`` 6726---------------------------------- 6727 6728Generates a defaulted parameter declaration for a `forwarding function`_. 6729 6730:Defined in: |match_header|_ 6731:Requires: ``a`` is a `Boost.Preprocessor sequence`__ of the form 6732 6733.. parsed-literal:: 6734 6735 (A0)(A1)…(A ## *n*) 6736 6737__ ../../../preprocessor/doc/data.html 6738 6739:Expands to: 6740 6741.. parsed-literal:: 6742 6743 typename **p**::match<**A0**\ , **A1**\ , …, **A** ## *n*>::type 6744 **x** = **p**\ () 6745 6746Configuration Macros 6747==================== 6748 6749.. |BOOST_PARAMETER_HAS_PERFECT_FORWARDING| replace:: ``BOOST_PARAMETER_HAS_PERFECT_FORWARDING`` 6750.. _BOOST_PARAMETER_HAS_PERFECT_FORWARDING: 6751 6752``BOOST_PARAMETER_HAS_PERFECT_FORWARDING`` 6753------------------------------------------ 6754 6755Determines whether or not the library supports perfect forwarding, or the 6756preservation of parameter value categories. Users can manually disable this 6757macro by ``#defining`` the |BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING|_ 6758macro. Otherwise, the library will ``#define`` this macro if and only if it 6759is not already defined, and if the configuration macros 6760|BOOST_NO_FUNCTION_TEMPLATE_ORDERING|_, |BOOST_NO_SFINAE|_, 6761|BOOST_NO_CXX11_RVALUE_REFERENCES|_, |BOOST_NO_CXX11_VARIADIC_TEMPLATES|_, and 6762|BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS|_ are not already defined by 6763|Boost_Config|_. 6764 6765:Defined in: |config_header|_ 6766 6767.. |BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING| replace:: ``BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING`` 6768.. _BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING: 6769 6770``BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING`` 6771---------------------------------------------- 6772 6773It may be necessary to test user code in case perfect forwarding support is 6774unavailable. Users can ``#define`` this macro either in their project 6775settings or before including any library header files. Doing so will leave 6776both |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and 6777|BOOST_PARAMETER_CAN_USE_MP11|_ undefined. 6778 6779.. |BOOST_PARAMETER_CAN_USE_MP11| replace:: ``BOOST_PARAMETER_CAN_USE_MP11`` 6780.. _BOOST_PARAMETER_CAN_USE_MP11: 6781 6782``BOOST_PARAMETER_CAN_USE_MP11`` 6783-------------------------------- 6784 6785Determines whether or not the library can use |Boost_MP11|_, a C++11 6786metaprogramming library. Users can manually disable this macro by 6787``#defining`` the |BOOST_PARAMETER_DISABLE_MP11_USAGE|_ macro or the 6788|BOOST_PARAMETER_DISABLE_PERFECT_FORWARDING|_ macro. Otherwise, the library 6789will ``#define`` this macro if and only if it is not already defined, if 6790|BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is defined, and if the configuration 6791macros |BOOST_NO_CXX11_CONSTEXPR|_, |BOOST_NO_CXX11_DECLTYPE_N3276|_, 6792|BOOST_NO_CXX11_AUTO_DECLARATIONS|_, |BOOST_NO_CXX11_TEMPLATE_ALIASES|_, 6793|BOOST_NO_CXX11_STATIC_ASSERT|_, |BOOST_NO_CXX11_HDR_TYPE_TRAITS|_, 6794|BOOST_NO_CXX11_HDR_INITIALIZER_LIST|_, and |BOOST_NO_CXX11_HDR_TUPLE|_ 6795are not already defined by |Boost_Config|_. 6796 6797.. Admonition:: Usage Note 6798 6799 |Boost_MP11|_ and |Boost_MPL|_ are **not** mutually exclusive. It's 6800 perfectly acceptable to specify deduced parameters using both quoted 6801 metafunctions and metafunction classes, for example. See 6802 |evaluate_category_cpp|_. 6803 6804:Defined in: |config_header|_ 6805:Example usage: 6806 6807Given the following definitions: 6808 6809.. parsed-literal:: 6810 6811 |BOOST_PARAMETER_NAME|_\(x) 6812 6813 template <typename A0> 6814 typename |boost_enable_if|_\<|std_is_same|_\<int,A0>,int>::type 6815 sfinae(A0 const& a0) 6816 { 6817 return 0; 6818 } 6819 6820|Boost_MP11|_ allows deduced parameters to be defined more succinctly: 6821 6822.. parsed-literal:: 6823 6824 template <typename T, typename Args> 6825 using predicate = |std_is_convertible|_\<T,char const*>; 6826 6827 |BOOST_PARAMETER_FUNCTION|_\((int), sfinae, tag, 6828 (deduced 6829 (optional 6830 (x 6831 , \*(|mp11_quote|_\<predicate>) 6832 , static_cast<char const*>(|std_nullptr|_\) 6833 ) 6834 ) 6835 ) 6836 ) 6837 { 6838 return 1; 6839 } 6840 6841Without |Boost_MP11|_, deduced parameter definitions tend to be more verbose: 6842 6843.. parsed-literal:: 6844 6845 struct predicate 6846 { 6847 template <typename T, typename Args> 6848 struct apply 6849 : |mpl_if|_\< 6850 |boost_is_convertible|_\<T,char const*> 6851 , |mpl_true|_\ // Still have to convert to a 6852 , |mpl_false|_\ // `Boolean Integral Constant`_. 6853 > 6854 { 6855 }; 6856 }; 6857 6858 |BOOST_PARAMETER_FUNCTION|_\((int), sfinae, tag, 6859 (deduced 6860 (optional 6861 (x 6862 , \*(predicate) 6863 , static_cast<char const*>(|std_nullptr|_\) 6864 ) 6865 ) 6866 ) 6867 ) 6868 { 6869 return 1; 6870 } 6871 6872Either way, the following assertions will succeed: 6873 6874.. parsed-literal:: 6875 6876 assert(1 == sfinae()); 6877 assert(1 == sfinae("foo")); 6878 assert(0 == sfinae(1)); 6879 6880As another example, given the following declarations and definitions: 6881 6882.. parsed-literal:: 6883 6884 |BOOST_PARAMETER_NAME|_\(x) 6885 |BOOST_PARAMETER_NAME|_\(y) 6886 6887 template <typename E, typename Args> 6888 void check0(E const& e, Args const& args); 6889 6890 template <typename P, typename E, typename ...Args> 6891 void check(E const& e, Args const&... args) 6892 { 6893 check0(e, P()(args...)); 6894 } 6895 6896Argument packs qualify as |Boost_MP11|_-style lists containing 6897|keyword tag type|\ s: 6898 6899.. parsed-literal:: 6900 6901 template <typename Args> 6902 struct some_functor 6903 { 6904 template <typename K> 6905 void operator()(K&&) const 6906 { 6907 // K is one of tag\:\:x, tag\:\:y, etc. 6908 } 6909 }; 6910 6911 template <typename E, typename Args> 6912 void check0(E const& e, Args const& args) 6913 { 6914 boost::mp11::mp_for_each<E>(some_functor<Args>()); 6915 } 6916 6917The first check determines whether or not the argument type of ``_y`` is the 6918same as the reference type of ``_x``, while the second check determines 6919whether or not the argument type of ``_y`` is convertible to the value type of 6920``_x``. Here, it's possible to access the reference and value result types of 6921indexing an argument pack a little more directly: 6922 6923.. parsed-literal:: 6924 6925 // Use mp_bind on tag\:\:x\:\:binding_fn to access the reference type of _x. 6926 check< 6927 |parameters|_\< 6928 tag\:\:x 6929 , |optional|_\< 6930 |deduced|_\<tag\:\:y> 6931 , |mp11_bind|_\< 6932 |std_is_same|_\ // |boost_is_same|_, standard version. 6933 , |mp11_1|_\ // will be bound to the argument type of _y. 6934 , |mp11_bind|_\< 6935 tag\:\:x\:\:binding_fn 6936 , |mp11_2|_\ // will be bound to the argument pack type. 6937 > 6938 > 6939 > 6940 > 6941 >((_x = 0, _y = 1), 0, 1); 6942 6943 // Use mp_bind_q on tag\:\:x to access the value type of _x. 6944 check< 6945 |parameters|_\< 6946 tag\:\:x 6947 , |optional|_\< 6948 |deduced|_\<tag\:\:y> 6949 , |mp11_bind|_\< 6950 |std_is_convertible|_\ // |boost_is_convertible|_, standard version. 6951 , |mp11_1|_\ // will be bound to the argument type of _y. 6952 , |mp11_bind_q|_\< 6953 tag\:\:x 6954 , |mp11_2|_\ // will be bound to the argument pack type. 6955 > 6956 > 6957 > 6958 > 6959 >((_x = 0U, _y = 1U), 0U, 1U); 6960 6961Argument packs still qualify as |Boost_MPL|_-style lists containing 6962|keyword tag type|\ s: 6963 6964.. parsed-literal:: 6965 6966 template <typename Args> 6967 struct some_functor 6968 { 6969 template <typename K> 6970 void operator()(K) const 6971 { 6972 // K is one of tag\:\:x, tag\:\:y, etc. 6973 } 6974 }; 6975 6976 template <typename E, typename Args> 6977 void check0(E const& e, Args const& args) 6978 { 6979 boost::mpl::for_each<E>(some_functor<Args>()); 6980 } 6981 6982However, without |Boost_MP11|_, the corresponding checks become a little more 6983verbose: 6984 6985.. parsed-literal:: 6986 6987 check< 6988 |parameters|_\< 6989 tag\:\:x 6990 , |optional|_\< 6991 |deduced|_\<tag\:\:y> 6992 , |mpl_if|_\< 6993 |boost_is_same|_\< 6994 |boost_add_lvalue_reference|_\<|mp11_1|_\> 6995 , |binding|_\<|mp11_2|_\, tag\:\:x> 6996 > 6997 , |mpl_true|_\ // Still have to convert to a 6998 , |mpl_false|_\ // `Boolean Integral Constant`_. 6999 > 7000 > 7001 > 7002 >((_x = 0, _y = 1), 0, 1); 7003 7004 // Use tag\:\:x\:\:_ or tag\:\:x\:\:_1 to access the value type of _x. 7005 check< 7006 |parameters|_\< 7007 tag\:\:x 7008 , |optional|_\< 7009 |deduced|_\<tag\:\:y> 7010 , |mpl_if|_\< 7011 |boost_is_convertible|_\<|mp11_1|_\, tag\:\:x\:\:_1> 7012 , |mpl_true|_\ // Still have to convert to a 7013 , |mpl_false|_\ // `Boolean Integral Constant`_. 7014 > 7015 > 7016 > 7017 >((_x = 0U, _y = 1U), 0U, 1U); 7018 7019The |singular_cpp|_, |compose_cpp|_, |optional_deduced_sfinae_cpp|_, and 7020|deduced_dep_pred_cpp|_ test programs demonstrate proper usage of this 7021macro. 7022 7023.. |BOOST_PARAMETER_DISABLE_MP11_USAGE| replace:: ``BOOST_PARAMETER_DISABLE_MP11_USAGE`` 7024.. _BOOST_PARAMETER_DISABLE_MP11_USAGE: 7025 7026``BOOST_PARAMETER_DISABLE_MP11_USAGE`` 7027-------------------------------------- 7028 7029It may be necessary to disable usage of |Boost_MP11|_ for compilers that 7030cannot support it. Users can ``#define`` this macro either in their project 7031settings or before including any library header files. Doing so will leave 7032|BOOST_PARAMETER_CAN_USE_MP11|_ undefined. 7033 7034.. |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE| replace:: ``BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE`` 7035.. _BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE: 7036 7037``BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE`` 7038----------------------------------------- 7039 7040If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is ``#defined``, then determines 7041the `MPL Variadic Sequence`_ underlying the nested ``parameter_spec`` type of 7042|parameters|. If the user does not manually ``#define`` this macro, then the 7043library will ``#define`` it as |mp11_list|_ if 7044|BOOST_PARAMETER_CAN_USE_MP11|_ is defined, |fusion_list|_ if 7045|BOOST_FUSION_HAS_VARIADIC_LIST|_ is defined (by |Boost_Fusion|_), 7046|fusion_deque|_ if |BOOST_FUSION_HAS_VARIADIC_DEQUE|_ is defined 7047(by |Boost_Fusion|_), or |mpl_vector|_ otherwise. 7048 7049:Example: 7050 7051.. parsed-literal:: 7052 7053 #define BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE |fusion_vector|_ 7054 7055:Defined in: |parameters_header|_ 7056 7057.. |BOOST_PARAMETER_MAX_ARITY| replace:: ``BOOST_PARAMETER_MAX_ARITY`` 7058.. _BOOST_PARAMETER_MAX_ARITY: 7059 7060``BOOST_PARAMETER_MAX_ARITY`` 7061----------------------------- 7062 7063If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is ``#defined``, then: 7064 7065* If the `MPL Variadic Sequence`_ underlying the nested ``parameter_spec`` 7066 type of |parameters| does not have a size limit--which is the case with 7067 |mp11_list|_, |fusion_list|_, and |fusion_deque|_, but not 7068 |mpl_vector|_--then this macro can be safely ignored. User code that 7069 manually defines |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE|_ should also 7070 manually define this macro to the size limit of the sequence if it has 7071 one. 7072 7073If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is **not** ``#defined``, then: 7074 7075* Mutable references must be wrapped by |boost_ref|_ or |std_ref|_ if passed 7076 by position to Boost.Parameter-enabled functions with arity greater than 7077 or equal to |BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY|_. 7078 7079:Defined in: |config_header|_ 7080:Default Value: |BOOST_MPL_LIMIT_VECTOR_SIZE|_ (defined by |Boost_MPL|_) if 7081 perfect forwarding is supported, ``8`` otherwise. 7082:Minimum Value: ``2`` 7083:Maximum Value: |BOOST_PARAMETER_COMPOSE_MAX_ARITY|_ 7084 7085.. |BOOST_PARAMETER_COMPOSE_MAX_ARITY| replace:: ``BOOST_PARAMETER_COMPOSE_MAX_ARITY`` 7086.. _BOOST_PARAMETER_COMPOSE_MAX_ARITY: 7087 7088``BOOST_PARAMETER_COMPOSE_MAX_ARITY`` 7089------------------------------------- 7090 7091If |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is **not** ``#defined``, then 7092determines the maximum number of arguments supported by the |compose| function 7093and by the |BOOST_PARAMETER_NO_SPEC_FUNCTION|_, 7094|BOOST_PARAMETER_NO_SPEC_MEMBER_FUNCTION|_, 7095|BOOST_PARAMETER_NO_SPEC_CONST_MEMBER_FUNCTION|_, 7096|BOOST_PARAMETER_NO_SPEC_FUNCTION_CALL_OPERATOR|_, 7097|BOOST_PARAMETER_NO_SPEC_CONST_FUNCTION_CALL_OPERATOR|_, 7098|BOOST_PARAMETER_NO_SPEC_CONSTRUCTOR|_, and 7099|BOOST_PARAMETER_NO_SPEC_NO_BASE_CONSTRUCTOR|_ code generation macros. 7100 7101:Defined in: |config_header|_ 7102:Default Value: ``20`` for a few older compilers, ``64`` otherwise 7103:Minimum Value: ``2`` 7104 7105.. |BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY| replace:: ``BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY`` 7106.. _BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY: 7107 7108``BOOST_PARAMETER_EXPONENTIAL_OVERLOAD_THRESHOLD_ARITY`` 7109-------------------------------------------------------- 7110 7111If this library does **not** support perfect forwarding, determines the number 7112of arguments less than which |parameters| generates an exponential number of 7113function call operator overloads, and greater than or equal to which 7114|parameters| does not. Will only be ``#defined`` by the library if it is 7115not already ``#defined`` and |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ is 7116**not** ``#defined``. 7117 7118:Defined in: |config_header|_ 7119:Default Value: ``0`` 7120:Minimum Value: ``0`` 7121 7122...Outside Of This Library 7123-------------------------- 7124 7125#. If |Boost_Config|_ defines the macro 7126 |BOOST_NO_FUNCTION_TEMPLATE_ORDERING|_, then the macros 7127 |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and 7128 |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined; otherwise, the 7129 code generation macros would not work correctly. 7130#. If |Boost_Config|_ defines the macro |BOOST_NO_SFINAE|_, then the macros 7131 |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and 7132 |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined; otherwise, keyword 7133 types generated by |BOOST_PARAMETER_NAME|_ and 7134 |BOOST_PARAMETER_NESTED_KEYWORD|_ would not work correctly. 7135#. If |Boost_Config|_ defines the macro 7136 |BOOST_NO_CXX11_RVALUE_REFERENCES|_, then the macros 7137 |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and 7138 |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7139#. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_VARIADIC_TEMPLATES|_, 7140 then the macros |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and 7141 |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7142#. If |Boost_Config|_ defines the macro 7143 |BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS|_, then the macros 7144 |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_ and 7145 |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7146#. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_CONSTEXPR|_, then the 7147 macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7148#. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_DECLTYPE_N3276|_, 7149 then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7150#. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_AUTO_DECLARATIONS|_, 7151 then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7152#. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_TEMPLATE_ALIASES|_, 7153 then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7154#. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_STATIC_ASSERT|_, then 7155 the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7156#. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_HDR_TYPE_TRAITS|_, 7157 then the macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7158#. If |Boost_Config|_ defines the macro 7159 |BOOST_NO_CXX11_HDR_INITIALIZER_LIST|_, then the macro 7160 |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7161#. If |Boost_Config|_ defines the macro |BOOST_NO_CXX11_HDR_TUPLE|_, then the 7162 macro |BOOST_PARAMETER_CAN_USE_MP11|_ will be left undefined. 7163#. If |Boost_Fusion|_ defines the macro |BOOST_FUSION_HAS_VARIADIC_LIST|_, 7164 if this library defines the macro 7165 |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_, and if 7166 |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE|_ is left undefined, then the 7167 `MPL Variadic Sequence`_ underlying the nested ``parameter_spec`` type of 7168 |parameters| will be |fusion_list|_. 7169#. If |Boost_Fusion|_ defines the macro |BOOST_FUSION_HAS_VARIADIC_DEQUE|_, 7170 if this library defines the macro 7171 |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_, and if 7172 |BOOST_PARAMETER_VARIADIC_MPL_SEQUENCE|_ is left undefined, then the 7173 `MPL Variadic Sequence`_ underlying the nested ``parameter_spec`` type of 7174 |parameters| will be |fusion_deque|_. 7175#. The value that |Boost_MPL|_ defines the macro 7176 |BOOST_MPL_LIMIT_VECTOR_SIZE|_ as will be the value that this library 7177 defines the macro |BOOST_PARAMETER_MAX_ARITY|_ as if this library defines 7178 the macro |BOOST_PARAMETER_HAS_PERFECT_FORWARDING|_. 7179 7180Tutorial 7181======== 7182 7183Follow `this link`__ to the Boost.Parameter tutorial documentation. 7184 7185__ index.html#tutorial 7186 7187////////////////////////////////////////////////////////////////////////////// 7188 7189.. [#thread] References to tag objects may be initialized multiple 7190 times. This scenario can only occur in the presence of 7191 threading. Because the C++ standard doesn't consider threading, 7192 it doesn't explicitly allow or forbid multiple initialization of 7193 references. That said, it's hard to imagine an implementation 7194 where it could make a difference. 7195 7196.. [#no_result_of] Where |BOOST_NO_RESULT_OF|_ is ``#defined``, 7197 |boost_result_of|_\ ``<F()>::type`` is replaced by ``F::result_type``. 7198 7199.. |std_nullptr| replace:: std::nullptr 7200.. _std_nullptr: http://en.cppreference.com/w/cpp/language/nullptr 7201.. |std_forward| replace:: std::forward 7202.. _std_forward: http://en.cppreference.com/w/cpp/utility/forward 7203.. |std_enable_if| replace:: std::enable_if 7204.. _std_enable_if: http://en.cppreference.com/w/cpp/types/enable_if 7205.. |std_is_convertible| replace:: std::is_convertible 7206.. _std_is_convertible: http://en.cppreference.com/w/cpp/types/is_convertible 7207.. |std_is_same| replace:: std::is_same 7208.. _std_is_same: http://en.cppreference.com/w/cpp/types/is_same 7209.. |std_ref| replace:: ``std::ref`` 7210.. _std_ref: http://en.cppreference.com/w/cpp/utility/functional/ref 7211.. |std_map| replace:: std::map 7212.. _std_map: http://en.cppreference.com/w/cpp/container/map 7213.. |std_string| replace:: std::string 7214.. _std_string: http://en.cppreference.com/w/cpp/string/basic_string 7215.. |std_bitset| replace:: std::bitset 7216.. _std_bitset: http://en.cppreference.com/w/cpp/utility/bitset 7217.. |Boost_Config| replace:: Boost.Config 7218.. _Boost_Config: ../../../config/doc/html/index.html 7219.. |BOOST_NO_FUNCTION_TEMPLATE_ORDERING| replace:: ``BOOST_NO_FUNCTION_TEMPLATE_ORDERING`` 7220.. _BOOST_NO_FUNCTION_TEMPLATE_ORDERING: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects 7221.. |BOOST_NO_SFINAE| replace:: ``BOOST_NO_SFINAE`` 7222.. _BOOST_NO_SFINAE: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__03_defects 7223.. |BOOST_NO_CXX11_AUTO_DECLARATIONS| replace:: ``BOOST_NO_CXX11_AUTO_DECLARATIONS`` 7224.. _BOOST_NO_CXX11_AUTO_DECLARATIONS: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7225.. |BOOST_NO_CXX11_CONSTEXPR| replace:: ``BOOST_NO_CXX11_CONSTEXPR`` 7226.. _BOOST_NO_CXX11_CONSTEXPR: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7227.. |BOOST_NO_CXX11_DECLTYPE_N3276| replace:: ``BOOST_NO_CXX11_DECLTYPE_N3276`` 7228.. _BOOST_NO_CXX11_DECLTYPE_N3276: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7229.. |BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS| replace:: ``BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS`` 7230.. _BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7231.. |BOOST_NO_CXX11_HDR_INITIALIZER_LIST| replace:: ``BOOST_NO_CXX11_HDR_INITIALIZER_LIST`` 7232.. _BOOST_NO_CXX11_HDR_INITIALIZER_LIST: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7233.. |BOOST_NO_CXX11_HDR_TUPLE| replace:: ``BOOST_NO_CXX11_HDR_TUPLE`` 7234.. _BOOST_NO_CXX11_HDR_TUPLE: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7235.. |BOOST_NO_CXX11_HDR_TYPE_TRAITS| replace:: ``BOOST_NO_CXX11_HDR_TYPE_TRAITS`` 7236.. _BOOST_NO_CXX11_HDR_TYPE_TRAITS: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7237.. |BOOST_NO_CXX11_RVALUE_REFERENCES| replace:: ``BOOST_NO_CXX11_RVALUE_REFERENCES`` 7238.. _BOOST_NO_CXX11_RVALUE_REFERENCES: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7239.. |BOOST_NO_CXX11_STATIC_ASSERT| replace:: ``BOOST_NO_CXX11_STATIC_ASSERT`` 7240.. _BOOST_NO_CXX11_STATIC_ASSERT: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7241.. |BOOST_NO_CXX11_TEMPLATE_ALIASES| replace:: ``BOOST_NO_CXX11_TEMPLATE_ALIASES`` 7242.. _BOOST_NO_CXX11_TEMPLATE_ALIASES: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7243.. |BOOST_NO_CXX11_VARIADIC_TEMPLATES| replace:: ``BOOST_NO_CXX11_VARIADIC_TEMPLATES`` 7244.. _BOOST_NO_CXX11_VARIADIC_TEMPLATES: ../../../config/doc/html/boost_config/boost_macro_reference.html#boost_config.boost_macro_reference.macros_that_describe_c__11_features_not_supported 7245.. |Boost_Preprocessor| replace:: Boost.Preprocessor 7246.. _Boost_Preprocessor: ../../../preprocessor/doc/index.html 7247.. _`sequence`: ../../../preprocessor/doc/data/sequences.html 7248.. |BOOST_PP_INC| replace:: BOOST_PP_INC 7249.. _BOOST_PP_INC: ../../../preprocessor/doc/ref/inc.html 7250.. |boost_enable_if| replace:: boost::enable_if 7251.. _boost_enable_if: ../../../core/doc/html/core/enable_if.html 7252.. |boost_enable_if_c| replace:: boost::enable_if_c 7253.. _boost_enable_if_c: ../../../core/doc/html/core/enable_if.html 7254.. |boost_lazy_enable_if| replace:: boost::lazy_enable_if 7255.. _boost_lazy_enable_if: ../../../core/doc/html/core/enable_if.html 7256.. |boost_lazy_enable_if_c| replace:: boost::lazy_enable_if_c 7257.. _boost_lazy_enable_if_c: ../../../core/doc/html/core/enable_if.html 7258.. |boost_disable_if| replace:: boost::disable_if 7259.. _boost_disable_if: ../../../core/doc/html/core/enable_if.html 7260.. |boost_disable_if_c| replace:: boost::disable_if_c 7261.. _boost_disable_if_c: ../../../core/doc/html/core/enable_if.html 7262.. |boost_lazy_disable_if| replace:: boost::lazy_disable_if 7263.. _boost_lazy_disable_if: ../../../core/doc/html/core/enable_if.html 7264.. |boost_lazy_disable_if_c| replace:: boost::lazy_disable_if_c 7265.. _boost_lazy_disable_if_c: ../../../core/doc/html/core/enable_if.html 7266.. |boost_ref| replace:: ``boost::ref`` 7267.. _boost_ref: ../../../core/doc/html/core/ref.html 7268.. |BOOST_NO_RESULT_OF| replace:: ``BOOST_NO_RESULT_OF`` 7269.. _BOOST_NO_RESULT_OF: ../../../utility/utility.htm#BOOST_NO_RESULT_OF 7270.. |boost_result_of| replace:: ``boost::result_of`` 7271.. _boost_result_of: ../../../utility/utility.htm#result_of 7272.. |boost_is_const| replace:: boost::is_const 7273.. _boost_is_const: ../../../type_traits/doc/html/boost_typetraits/is_const.html 7274.. |boost_is_convertible| replace:: boost::is_convertible 7275.. _boost_is_convertible: ../../../type_traits/doc/html/boost_typetraits/is_convertible.html 7276.. |boost_is_same| replace:: boost::is_same 7277.. _boost_is_same: ../../../type_traits/doc/html/boost_typetraits/is_same.html 7278.. |boost_is_scalar| replace:: boost::is_scalar 7279.. _boost_is_scalar: ../../../type_traits/doc/html/boost_typetraits/is_scalar.html 7280.. |boost_add_lvalue_reference| replace:: boost::add_lvalue_reference 7281.. _boost_add_lvalue_reference: ../../../type_traits/doc/html/boost_typetraits/add_lvalue_reference.html 7282.. |boost_remove_reference| replace:: boost::remove_reference 7283.. _boost_remove_reference: ../../../type_traits/doc/html/boost_typetraits/remove_reference.html 7284.. |Boost_MPL| replace:: Boost.MPL 7285.. _Boost_MPL: ../../../mpl/doc/index.html 7286.. _`Metafunction`: ../../../mpl/doc/refmanual/metafunction.html 7287.. _`Boolean Integral Constant`: ../../../mpl/doc/refmanual/integral-constant.html 7288.. _`MPL Binary Metafunction Class`: ../../../mpl/doc/refmanual/metafunction-class.html 7289.. _`MPL Forward Sequence`: ../../../mpl/doc/refmanual/forward-sequence.html 7290.. _`MPL Associative Sequence`: ../../../mpl/doc/refmanual/associative-sequence.html 7291.. _`MPL Variadic Sequence`: ../../../mpl/doc/refmanual/variadic-sequence.html 7292.. |BOOST_MPL_LIMIT_VECTOR_SIZE| replace:: ``BOOST_MPL_LIMIT_VECTOR_SIZE`` 7293.. _BOOST_MPL_LIMIT_VECTOR_SIZE: ../../../mpl/doc/refmanual/limit-vector-size.html 7294.. |mpl_eval_if| replace:: boost::mpl::eval_if 7295.. _mpl_eval_if: ../../../mpl/doc/refmanual/eval-if.html 7296.. |mpl_true| replace:: mpl::true\_ 7297.. _mpl_true: ../../../mpl/doc/refmanual/bool.html 7298.. |mpl_false| replace:: mpl::false\_ 7299.. _mpl_false: ../../../mpl/doc/refmanual/bool.html 7300.. |mpl_if| replace:: mpl::if\_ 7301.. _mpl_if: ../../../mpl/doc/refmanual/if.html 7302.. |mpl_vector| replace:: ``boost::mpl::vector`` 7303.. _mpl_vector: ../../../mpl/doc/refmanual/vector.html 7304.. |Boost_MP11| replace:: Boost.MP11 7305.. _Boost_MP11: ../../../mp11/doc/html/mp11.html 7306.. |mp11_quote| replace:: boost::mp11::mp_quote 7307.. _mp11_quote: ../../../mp11/doc/html/mp11.html#mp_quotef 7308.. |mp11_1| replace:: boost::mp11::_1 7309.. _mp11_1: ../../../mp11/doc/html/mp11.html#1_9 7310.. |mp11_2| replace:: boost::mp11::_2 7311.. _mp11_2: ../../../mp11/doc/html/mp11.html#1_9 7312.. |mp11_bind| replace:: boost::mp11::mp_bind 7313.. _mp11_bind: ../../../mp11/doc/html/mp11.html#mp_bindf_t 7314.. |mp11_bind_q| replace:: boost::mp11::mp_bind_q 7315.. _mp11_bind_q: ../../../mp11/doc/html/mp11.html#mp_bind_qq_t 7316.. |mp11_list| replace:: ``boost::mp11::mp_list`` 7317.. _mp11_list: ../../../mp11/doc/html/mp11.html#mp_listt 7318.. |Boost_Fusion| replace:: Boost.Fusion 7319.. _Boost_Fusion: ../../../fusion/doc/html/index.html 7320.. |BOOST_FUSION_HAS_VARIADIC_DEQUE| replace:: ``BOOST_FUSION_HAS_VARIADIC_DEQUE`` 7321.. _BOOST_FUSION_HAS_VARIADIC_DEQUE: ../../../../boost/fusion/container/deque/deque_fwd.hpp 7322.. |BOOST_FUSION_HAS_VARIADIC_LIST| replace:: ``BOOST_FUSION_HAS_VARIADIC_LIST`` 7323.. _BOOST_FUSION_HAS_VARIADIC_LIST: ../../../../boost/fusion/container/list/list_fwd.hpp 7324.. |fusion_vector| replace:: ``boost::fusion::vector`` 7325.. _fusion_vector: ../../../fusion/doc/html/fusion/container/vector.html 7326.. |fusion_deque| replace:: ``boost::fusion::deque`` 7327.. _fusion_deque: ../../../fusion/doc/html/fusion/container/deque.html 7328.. |fusion_list| replace:: ``boost::fusion::list`` 7329.. _fusion_list: ../../../fusion/doc/html/fusion/container/list.html 7330.. |config_header| replace:: boost/parameter/config.hpp 7331.. _config_header: ../../../../boost/parameter/config.hpp 7332.. |binding_header| replace:: boost/parameter/binding.hpp 7333.. _binding_header: ../../../../boost/parameter/binding.hpp 7334.. |value_type_header| replace:: boost/parameter/value_type.hpp 7335.. _value_type_header: ../../../../boost/parameter/value_type.hpp 7336.. |are_tagged_arguments_header| replace:: boost/parameter/are_tagged_arguments.hpp 7337.. _are_tagged_arguments_header: ../../../../boost/parameter/are_tagged_arguments.hpp 7338.. |is_argument_pack_header| replace:: boost/parameter/is_argument_pack.hpp 7339.. _is_argument_pack_header: ../../../../boost/parameter/is_argument_pack.hpp 7340.. |template_keyword_header| replace:: boost/parameter/template_keyword.hpp 7341.. _template_keyword_header: ../../../../boost/parameter/template_keyword.hpp 7342.. |keyword_header| replace:: boost/parameter/keyword.hpp 7343.. _keyword_header: ../../../../boost/parameter/keyword.hpp 7344.. |name_header| replace:: boost/parameter/name.hpp 7345.. _name_header: ../../../../boost/parameter/name.hpp 7346.. |nested_keyword_header| replace:: boost/parameter/nested_keyword.hpp 7347.. _nested_keyword_header: ../../../../boost/parameter/nested_keyword.hpp 7348.. |compose_header| replace:: boost/parameter/compose.hpp 7349.. _compose_header: ../../../../boost/parameter/compose.hpp 7350.. |preprocessor_no_spec_header| replace:: boost/parameter/preprocessor_no_spec.hpp 7351.. _preprocessor_no_spec_header: ../../../../boost/parameter/preprocessor_no_spec.hpp 7352.. |required_header| replace:: boost/parameter/required.hpp 7353.. _required_header: ../../../../boost/parameter/required.hpp 7354.. |optional_header| replace:: boost/parameter/optional.hpp 7355.. _optional_header: ../../../../boost/parameter/optional.hpp 7356.. |deduced_header| replace:: boost/parameter/deduced.hpp 7357.. _deduced_header: ../../../../boost/parameter/deduced.hpp 7358.. |parameters_header| replace:: boost/parameter/parameters.hpp 7359.. _parameters_header: ../../../../boost/parameter/parameters.hpp 7360.. |match_header| replace:: boost/parameter/match.hpp 7361.. _match_header: ../../../../boost/parameter/match.hpp 7362.. |macros_header| replace:: boost/parameter/macros.hpp 7363.. _macros_header: ../../../../boost/parameter/macros.hpp 7364.. |preprocessor_header| replace:: boost/parameter/preprocessor.hpp 7365.. _preprocessor_header: ../../../../boost/parameter/preprocessor.hpp 7366.. |function_type_tpl_param_cpp| replace:: function_type_tpl_param.cpp 7367.. _function_type_tpl_param_cpp: ../../test/function_type_tpl_param.cpp 7368.. |ntp_cpp| replace:: test/ntp.cpp 7369.. _ntp_cpp: ../../test/ntp.cpp 7370.. |singular_cpp| replace:: singular.cpp 7371.. _singular_cpp: ../../test/singular.cpp 7372.. |compose_cpp| replace:: compose.cpp 7373.. _compose_cpp: ../../test/compose.cpp 7374.. |evaluate_category_cpp| replace:: evaluate_category.cpp 7375.. _evaluate_category_cpp: ../../test/evaluate_category.cpp 7376.. |parameterized_inheritance_cpp| replace:: parameterized_inheritance.cpp 7377.. _parameterized_inheritance_cpp: ../../test/parameterized_inheritance.cpp 7378.. |preproc_eval_cat_no_spec_cpp| replace:: preprocessor_eval_cat_no_spec.cpp 7379.. _preproc_eval_cat_no_spec_cpp: ../../test/preprocessor_eval_cat_no_spec.cpp 7380.. |preprocessor_eval_cat_cpp| replace:: preprocessor_eval_category.cpp 7381.. _preprocessor_eval_cat_cpp: ../../test/preprocessor_eval_category.cpp 7382.. |preprocessor_eval_cat_8_cpp| replace:: preprocessor_eval_cat_8.cpp 7383.. _preprocessor_eval_cat_8_cpp: ../../test/preprocessor_eval_cat_8.cpp 7384.. |optional_deduced_sfinae_cpp| replace:: optional_deduced_sfinae.cpp 7385.. _optional_deduced_sfinae_cpp: ../../test/optional_deduced_sfinae.cpp 7386.. |mpl_cpp| replace:: mpl.cpp 7387.. _mpl_cpp: ../../test/mpl.cpp 7388.. |preprocessor_cpp| replace:: preprocessor.cpp 7389.. _preprocessor_cpp: ../../test/preprocessor.cpp 7390.. |preprocessor_deduced_cpp| replace:: preprocessor_deduced.cpp 7391.. _preprocessor_deduced_cpp: ../../test/preprocessor_deduced.cpp 7392.. |deduced_dep_pred_cpp| replace:: deduced_dependent_predicate.cpp 7393.. _deduced_dep_pred_cpp: ../../test/deduced_dependent_predicate.cpp 7394.. |macros_eval_cat_cpp| replace:: macros_eval_category.cpp 7395.. _macros_eval_cat_cpp: ../../test/macros_eval_category.cpp 7396.. |macros_cpp| replace:: macros.cpp 7397.. _macros_cpp: ../../test/macros.cpp 7398 7399