• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Macros/Broken Compiler Workarounds//BOOST_MPL_AUX_LAMBDA_SUPPORT
2
3BOOST_MPL_AUX_LAMBDA_SUPPORT
4============================
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    #define BOOST_MPL_AUX_LAMBDA_SUPPORT(arity, fun, params) \\
12        |unspecified-token-seq| \\
13    /\*\*/
14
15
16
17Description
18-----------
19
20Enables metafunction ``fun`` for the use in |Lambda Expression|\ s on
21compilers that don't support partial template specialization or/and
22template template parameters. Expands to nothing on conforming compilers.
23
24
25Header
26------
27
28.. parsed-literal::
29
30    #include <boost/mpl/aux\_/lambda_support.hpp>
31
32
33Parameters
34----------
35
36+---------------+-------------------------------+---------------------------------------------------+
37| Parameter     | Requirement                   | Description                                       |
38+===============+===============================+===================================================+
39| ``arity``     | An integral constant          | The metafunction's arity, i.e. the number of its  |
40|               |                               | template parameters, including the defaults.      |
41+---------------+-------------------------------+---------------------------------------------------+
42| ``fun``       | A legal identifier token      | The metafunction's name.                          |
43+---------------+-------------------------------+---------------------------------------------------+
44| ``params``    | A |PP-tuple|                  | A tuple of the metafunction's parameter names, in |
45|               |                               | their original order, including the defaults.     |
46+---------------+-------------------------------+---------------------------------------------------+
47
48
49Expression semantics
50--------------------
51
52For any integral constant ``n``, a |Metafunction| ``fun``, and arbitrary types |A1...An|:
53
54
55.. parsed-literal::
56
57    template< typename A1,\ |...| typename A\ *n* > struct fun
58    {
59        // |...|
60
61        BOOST_MPL_AUX_LAMBDA_SUPPORT(n, fun, (A1,\ |...|\ A\ *n*\ ))
62    };
63
64:Precondition:
65    Appears in ``fun``\ 's scope, immediately followed by the scope-closing
66    bracket (``}``).
67
68:Return type:
69    None.
70
71:Semantics:
72    Expands to nothing and has no effect on conforming compilers. On compilers that
73    don't support partial template specialization or/and template template parameters
74    expands to an unspecified token sequence enabling ``fun`` to participate in
75    |Lambda Expression|\ s with the semantics described in this manual.
76
77
78Example
79-------
80
81.. parsed-literal::
82
83    template< typename T, typename U = int > struct f
84    {
85        typedef T type[sizeof(U)];
86
87        BOOST_MPL_AUX_LAMBDA_SUPPORT(2, f, (T,U))
88    };
89
90    typedef apply\ ``1``\< f<char,_1>,long >::type r;
91    BOOST_MPL_ASSERT(( is_same< r, char[sizeof(long)] > ));
92
93
94See also
95--------
96
97|Macros|, |Metafunctions|, |Lambda Expression|
98
99
100.. |PP-tuple| replace:: `PP-tuple <http://www.boost.org/libs/preprocessor/doc/data/tuples.html>`__
101
102
103.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
104   Distributed under the Boost Software License, Version 1.0. (See accompanying
105   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
106