merged changeset 63726 from trunk

[SVN r63907]
This commit is contained in:
Daniel Walker committed 2010-07-12 01:36:38 +00:00
1 parent fb038c188d
commit cbd633b4d0
4 files changed
+200 -530

No files matched your search

+25 -28
View File
@@ -13,7 +13,7 @@ Synopsis
.. parsed-literal::
#define BOOST_MPL_HAS_XXX_TEMPLATE_DEF(name, n) \\
#define BOOST_MPL_HAS_XXX_TEMPLATE_DEF(name) \\
|unspecified-token-seq| \\
/\*\*/
@@ -21,17 +21,16 @@ Synopsis
Description
-----------
Expands into the definition of a boolean n-ary |Metafunction|
``has_name`` such that for any types ``x, a1, a2, ..., an``
``has_name<x, a1, ..., an>::value == true`` if and only if ``x`` is a
class type and has a nested template member ``x::template name<a1,
..., an>``.
Expands into the definition of a boolean |Metafunction| ``has_name``
such that for any type ``x`` ``has_name<x>::value == true`` if and
only if ``x`` is a class type and has a nested template member
``x::template name`` with no more than
|BOOST_MPL_LIMIT_METAFUNCTION_ARITY| parameters.
On deficient compilers not capable of performing the detection,
``has_name<x, a1, ..., an>::value`` always returns ``false``. A
boolean configuration macro, |BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE|, is
provided to signal or override the "deficient" status of a particular
compiler.
``has_name<x>::value`` is always ``false``. A boolean configuration
macro, |BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE|, is provided to signal or
override the "deficient" status of a particular compiler.
|Note:| |BOOST_MPL_HAS_XXX_TEMPLATE_DEF| is a simplified front end to
the |BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF| introspection macro |-- end
@@ -55,19 +54,16 @@ Parameters
+===============+===============================+===================================================+
| ``name`` | A legal identifier token | A name of the template member being detected. |
+---------------+-------------------------------+---------------------------------------------------+
| ``n`` | An integral constant >= 0 | The arity of the template member being detected. |
+---------------+-------------------------------+---------------------------------------------------+
Expression semantics
--------------------
For any legal C++ identifier ``name`` and integral constant expression
``n`` greater than or equal to 0:
For any legal C++ identifier ``name``:
.. parsed-literal::
BOOST_MPL_HAS_XXX_TEMPLATE_DEF(name, n)
BOOST_MPL_HAS_XXX_TEMPLATE_DEF(name)
:Precondition:
Appears at namespace scope.
@@ -81,7 +77,7 @@ For any legal C++ identifier ``name`` and integral constant expression
.. parsed-literal::
BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(
BOOST_PP_CAT(has\_,name), name, n, false
BOOST_PP_CAT(has\_,name), name, false
)
@@ -90,7 +86,7 @@ Example
.. parsed-literal::
BOOST_MPL_HAS_XXX_TEMPLATE_DEF(xxx, 1)
BOOST_MPL_HAS_XXX_TEMPLATE_DEF(xxx)
struct test1 {};
struct test2 { void xxx(); };
@@ -102,24 +98,25 @@ Example
struct test8 { typedef void (xxx)(); };
struct test9 { template< class T > struct xxx {}; };
BOOST_MPL_ASSERT_NOT(( has_xxx<test1, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test2, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test3, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test4, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test5, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test6, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test7, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test8, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test1> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test2> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test3> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test4> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test5> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test6> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test7> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test8> ));
#if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
BOOST_MPL_ASSERT(( has_xxx<test9, int> ));
BOOST_MPL_ASSERT(( has_xxx<test9> ));
#endif
BOOST_MPL_ASSERT(( has_xxx<test9, int, true\_> ));
BOOST_MPL_ASSERT(( has_xxx<test9, true\_> ));
See also
--------
|Macros|, |BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF|, |BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE|
|Macros|, |BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF|,
|BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE|, |BOOST_MPL_LIMIT_METAFUNCTION_ARITY|
@@ -13,7 +13,7 @@ Synopsis
.. parsed-literal::
#define BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(trait, name, n, default\_) \\
#define BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(trait, name, default\_) \\
|unspecified-token-seq| \\
/\*\*/
@@ -21,19 +21,19 @@ Synopsis
Description
-----------
Expands into the definition of a boolean n-ary |Metafunction| ``trait``
such that for any types ``x, a1, a2, ..., an`` ``trait<x, a1, ...,
an>::value == true`` if and only if ``x`` is a class type and has a
nested template member ``x::template name<a1, ..., an>``.
Expands into the definition of a boolean |Metafunction| ``trait`` such
that for any type ``x`` ``trait<x>::value == true`` if and only if
``x`` is a class type and has a nested template member ``x::template
name`` with no more than |BOOST_MPL_LIMIT_METAFUNCTION_ARITY|
parameters.
On deficient compilers not capable of performing the detection,
``trait<x, a1, ..., an>::value`` always returns a fallback value
``default_``. A boolean configuration macro,
|BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE|, is provided to signal or override
the "deficient" status of a particular compiler. |Note:| The fallback
value can also be provided at the point of the metafunction
invocation; see the `Expression semantics` section for details |-- end
note|
``trait<x>::value`` always returns a fallback value ``default_``. A
boolean configuration macro, |BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE|, is
provided to signal or override the "deficient" status of a particular
compiler. |Note:| The fallback value can also be provided at the
point of the metafunction invocation; see the `Expression semantics`
section for details |-- end note|
Header
@@ -54,8 +54,6 @@ Parameters
+---------------+-------------------------------+---------------------------------------------------+
| ``name`` | A legal identifier token | A name of the member being detected. |
+---------------+-------------------------------+---------------------------------------------------+
| ``n`` | An integral constant >= 0 | The arity of the template member being detected. |
+---------------+-------------------------------+---------------------------------------------------+
| ``default_`` | An boolean constant | A fallback value for the deficient compilers. |
+---------------+-------------------------------+---------------------------------------------------+
@@ -63,14 +61,13 @@ Parameters
Expression semantics
--------------------
For any legal C++ identifiers ``trait`` and ``name``, integral
constant expression ``n`` greater than or equal to 0, boolean constant
For any legal C++ identifiers ``trait`` and ``name``, boolean constant
expression ``c1``, boolean |Integral Constant| ``c2``, and arbitrary
type ``x``:
.. parsed-literal::
BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(trait, name, n, c1)
BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(trait, name, c1)
:Precondition:
Appears at namespace scope.
@@ -86,7 +83,6 @@ type ``x``:
template<
typename X
, typename A1, ..., typename An
, typename fallback = boost::mpl::bool\_<c1>
>
struct trait
@@ -100,7 +96,7 @@ type ``x``:
.. parsed-literal::
typedef trait<x, a1, ..., an>::type r;
typedef trait<x>::type r;
:Return type:
|Integral Constant|.
@@ -108,13 +104,13 @@ type ``x``:
:Semantics:
If |BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE| is defined, ``r::value
== c1``; otherwise, ``r::value == true`` if and only if ``x``
is a class type that has a nested type member ``x::template
name<a1, ..., an>``.
is a class type that has a nested template member ``x::template
name`` with no more than |BOOST_MPL_LIMIT_METAFUNCTION_ARITY|.
.. parsed-literal::
typedef trait< x, a1, ..., an, c2 >::type r;
typedef trait< x, c2 >::type r;
:Return type:
|Integral Constant|.
@@ -125,7 +121,7 @@ type ``x``:
.. parsed-literal::
typedef trait<x, a1, ..., an>::type r;
typedef trait<x>::type r;
Example
@@ -134,7 +130,7 @@ Example
.. parsed-literal::
BOOST_MPL_HAS_XXX_TEMPLATE_NAMED_DEF(
has_xxx, xxx, 1, false
has_xxx, xxx, false
)
struct test1 {};
@@ -147,24 +143,25 @@ Example
struct test8 { typedef void (xxx)(); };
struct test9 { template< class T > struct xxx {}; };
BOOST_MPL_ASSERT_NOT(( has_xxx<test1, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test2, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test3, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test4, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test5, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test6, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test7, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test8, int> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test1> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test2> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test3> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test4> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test5> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test6> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test7> ));
BOOST_MPL_ASSERT_NOT(( has_xxx<test8> ));
#if !defined(BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE)
BOOST_MPL_ASSERT(( has_xxx<test9, int> ));
BOOST_MPL_ASSERT(( has_xxx<test9> ));
#endif
BOOST_MPL_ASSERT(( has_xxx<test9, int, true\_> ));
BOOST_MPL_ASSERT(( has_xxx<test9, true\_> ));
See also
--------
|Macros|, |BOOST_MPL_HAS_XXX_TEMPLATE_DEF|, |BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE|
|Macros|, |BOOST_MPL_HAS_XXX_TEMPLATE_DEF|,
|BOOST_MPL_CFG_NO_HAS_XXX_TEMPLATE|, |BOOST_MPL_LIMIT_METAFUNCTION_ARITY|