]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/libs/mpl/doc/src/refmanual/HAS_XXX_TEMPLATE_DEF.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / HAS_XXX_TEMPLATE_DEF.rst
CommitLineData
7c673cae
FG
1.. Macros/Introspection//BOOST_MPL_HAS_XXX_TEMPLATE_DEF
2
3.. Copyright Daniel Walker 2007.
4.. Distributed under the Boost
5.. Software License, Version 1.0. (See accompanying
6.. file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7
8BOOST_MPL_HAS_XXX_TEMPLATE_DEF
9==============================
10
11Synopsis
12--------
13
14.. parsed-literal::
15
16 #define BOOST_MPL_HAS_XXX_TEMPLATE_DEF(name) \\
17 |unspecified-token-seq| \\
18 /\*\*/
19
20
21Description
22-----------
23
24Expands into the definition of a boolean |Metafunction| ``has_name``
25such that for any type ``x`` ``has_name<x>::value == true`` if and
26only if ``x`` is a class type and has a nested template member
27``x::template name`` with no more than
28|BOOST_MPL_LIMIT_METAFUNCTION_ARITY| parameters.
29
30On deficient compilers not capable of performing the detection,
31``has_name<x>::value`` is always ``false``. A boolean configuration
32macro, |BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE|, is provided to signal or
33override the "deficient" status of a particular compiler.
34
35|Note:| |BOOST_MPL_HAS_XXX_TEMPLATE_DEF| is a simplified front end to
36the |BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF| introspection macro |-- end
37note|
38
39
40Header
41------
42
43.. parsed-literal::
44
45 #include <boost/mpl/has_xxx.hpp>
46
47
48Parameters
49----------
50
51
52+---------------+-------------------------------+---------------------------------------------------+
53| Parameter | Requirement | Description |
54+===============+===============================+===================================================+
55| ``name`` | A legal identifier token | A name of the template member being detected. |
56+---------------+-------------------------------+---------------------------------------------------+
57
58
59Expression semantics
60--------------------
61
62For any legal C++ identifier ``name``:
63
64.. parsed-literal::
65
66 BOOST_MPL_HAS_XXX_TEMPLATE_DEF(name)
67
68:Precondition:
69 Appears at namespace scope.
70
71:Return type:
72 None.
73
74:Semantics:
75 Equivalent to
76
77 .. parsed-literal::
78
79 BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(
80 BOOST_PP_CAT(has\_,name), name, false
81 )
82
83
84Example
85-------
86
87.. parsed-literal::
88
89 BOOST_MPL_HAS_XXX_TEMPLATE_DEF(xxx)
90
91 struct test1 {};
92 struct test2 { void xxx(); };
93 struct test3 { int xxx; };
94 struct test4 { static int xxx(); };
95 struct test5 { typedef int xxx; };
96 struct test6 { struct xxx; };
97 struct test7 { typedef void (\*xxx)(); };
98 struct test8 { typedef void (xxx)(); };
99 struct test9 { template< class T > struct xxx {}; };
100
101 BOOST_MPL_ASSERT_NOT(( has_xxx<test1> ));
102 BOOST_MPL_ASSERT_NOT(( has_xxx<test2> ));
103 BOOST_MPL_ASSERT_NOT(( has_xxx<test3> ));
104 BOOST_MPL_ASSERT_NOT(( has_xxx<test4> ));
105 BOOST_MPL_ASSERT_NOT(( has_xxx<test5> ));
106 BOOST_MPL_ASSERT_NOT(( has_xxx<test6> ));
107 BOOST_MPL_ASSERT_NOT(( has_xxx<test7> ));
108 BOOST_MPL_ASSERT_NOT(( has_xxx<test8> ));
109
110 #if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
111 BOOST_MPL_ASSERT(( has_xxx<test9> ));
112 #endif
113
114 BOOST_MPL_ASSERT(( has_xxx<test9, true\_> ));
115
116
117See also
118--------
119
120|Macros|, |BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF|,
121|BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE|, |BOOST_MPL_LIMIT_METAFUNCTION_ARITY|
122