Compare commits

..
Author SHA1 Message Date
nobody 99cb7ae4bb This commit was manufactured by cvs2svn to create tag
'Version_1_32_0'.

[SVN r26264]
2004-11-19 19:19:18 +00:00
Aleksey Gurtovoy b926c42b37 refmanual.pdf checkin
[SVN r26218]
2004-11-15 13:18:16 +00:00
Aleksey Gurtovoy 82d4d0a52a GCC workaround
[SVN r26217]
2004-11-15 13:12:51 +00:00
Aleksey Gurtovoy f431ed7cf8 new MPL docs
[SVN r26213]
2004-11-15 12:30:30 +00:00
Aleksey Gurtovoy 54a5f8f55f new MPL docs
[SVN r26212]
2004-11-15 12:24:13 +00:00
Aleksey Gurtovoy d5e241cd2a accumulate checkin
[SVN r26206]
2004-11-15 04:55:58 +00:00
Aleksey Gurtovoy a447303946 empty_sequence checkin
[SVN r26201]
2004-11-13 20:19:44 +00:00
Aleksey Gurtovoy 3271fd328a iterator tags fix
[SVN r26179]
2004-11-11 05:15:08 +00:00
Aleksey Gurtovoy b413fb18b4 add min/max headers
[SVN r26178]
2004-11-11 04:50:18 +00:00
Aleksey Gurtovoy 3008c9934d final fixes
[SVN r26176]
2004-11-10 23:53:10 +00:00
Aleksey Gurtovoy a009ac5eb3 final fixes
[SVN r26175]
2004-11-10 23:38:18 +00:00
Aleksey Gurtovoy 65ad003b9a deque
[SVN r26174]
2004-11-10 21:06:20 +00:00
Aleksey Gurtovoy 79230d7f06 set_c
[SVN r26173]
2004-11-10 16:18:11 +00:00
Aleksey Gurtovoy caca0c2451 set_c
[SVN r26172]
2004-11-10 16:06:51 +00:00
Aleksey Gurtovoy 262a206b3c set_c
[SVN r26171]
2004-11-10 15:59:54 +00:00
Aleksey Gurtovoy a13c2f153c update paper
[SVN r26170]
2004-11-10 12:59:26 +00:00
Aleksey Gurtovoy 30d3389b92 convert replace/replace_if into sequence-building algorithms
[SVN r26153]
2004-11-08 19:00:27 +00:00
Aleksey Gurtovoy 0d161d3c40 na spec bug fix
[SVN r26152]
2004-11-08 18:23:49 +00:00
Aleksey Gurtovoy 9b6b432157 MSVC 6.5 fix
[SVN r26150]
2004-11-08 15:15:49 +00:00
Aleksey Gurtovoy 368bc46576 fix dereference
[SVN r26115]
2004-11-04 13:35:46 +00:00
Aleksey Gurtovoy a996d1749c fix dereference
[SVN r26112]
2004-11-04 12:40:53 +00:00
Aleksey Gurtovoy 061681c440 fix parameter name
[SVN r26098]
2004-11-03 07:59:14 +00:00
Aleksey Gurtovoy 3756b72713 check for STLPORT instead of specific compiler
[SVN r25965]
2004-10-30 08:27:47 +00:00
Aleksey Gurtovoy ab0da77c2e more Borland fixes
[SVN r25964]
2004-10-30 08:22:23 +00:00
Aleksey Gurtovoy 1f249a29bd invert incorrect Borland check
[SVN r25963]
2004-10-30 08:20:20 +00:00
Aleksey Gurtovoy 6a54b331ce numeric ops fixes
[SVN r25958]
2004-10-30 06:26:16 +00:00
Aleksey Gurtovoy 039f451abd fix Borland regression
[SVN r25956]
2004-10-30 06:10:35 +00:00
Aleksey Gurtovoy 7068cab3e1 fix BoostBook/broken links/invalid filenames/etc.
[SVN r25931]
2004-10-29 09:40:12 +00:00
Aleksey Gurtovoy 4a600a9c7a merged gcc 2.95 fixes from the main trunk
[SVN r25876]
2004-10-26 14:57:30 +00:00
Aleksey Gurtovoy e2df32ef25 merge tru64cxx fixes from the main trunk
[SVN r25851]
2004-10-24 08:27:10 +00:00
Aleksey Gurtovoy 9b939e1905 merge numeric protocol fixes from the main trunk
[SVN r25847]
2004-10-24 06:36:25 +00:00
Aleksey Gurtovoy 63f9743547 merge numeric protocol fixes from the main trunk
[SVN r25846]
2004-10-24 06:31:11 +00:00
nobody 3db141ecbb This commit was manufactured by cvs2svn to create branch 'RC_1_32_0'.
[SVN r25797]
2004-10-20 08:26:43 +00:00
384 changed files with 191 additions and 22723 deletions
+1 -6
View File
@@ -1,9 +1,4 @@
//
// Copyright 2005 David Abrahams and Aleksey Gurtovoy. Distributed
// under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
#include "boost/mpl/long.hpp"
#include "boost/mpl/alias.hpp"
-91
View File
@@ -1,91 +0,0 @@
.. Macros/Asserts//BOOST_MPL_ASSERT
BOOST_MPL_ASSERT
================
Synopsis
--------
.. parsed-literal::
#define BOOST_MPL_ASSERT( pred ) \\
|unspecified-token-seq| \\
/\*\*/
Description
-----------
Generates a compilation error when the predicate ``pred`` holds false.
Header
------
.. parsed-literal::
#include <boost/mpl/assert.hpp>
Parameters
----------
+---------------+-----------------------------------+-------------------------------+
| Parameter | Requirement | Description |
+===============+===================================+===============================+
| ``pred`` | Boolean nullary |Metafunction| | A predicate to be asserted. |
+---------------+-----------------------------------+-------------------------------+
Expression semantics
--------------------
For any boolean nullary |Metafunction| ``pred``:
.. parsed-literal::
BOOST_MPL_ASSERT(( pred ));
:Return type:
None.
:Semantics:
Generates a compilation error if ``pred::type::value != true``, otherwise
has no effect. Note that double parentheses are required even if no commas
appear in the condition.
When possible within the compiler's diagnostic capabilities,
the error message will include the predicate's full type name, and have a
general form of:
.. parsed-literal::
|...| \*\*\*\*\*\*\*\*\*\*\*\* pred::\*\*\*\*\*\*\*\*\*\*\*\* |...|
Example
-------
::
template< typename T, typename U > struct my
{
// ...
BOOST_MPL_ASSERT(( is_same< T,U > ));
};
my<void*,char*> test;
// In instantiation of `my<void, char*>':
// instantiated from here
// conversion from `
// mpl_::failed************boost::is_same<void, char*>::************' to
// non-scalar type `mpl_::assert<false>' requested
See also
--------
|Asserts|, |BOOST_MPL_ASSERT_NOT|, |BOOST_MPL_ASSERT_MSG|, |BOOST_MPL_ASSERT_RELATION|
-129
View File
@@ -1,129 +0,0 @@
.. Macros/Asserts//BOOST_MPL_ASSERT_MSG
BOOST_MPL_ASSERT_MSG
====================
Synopsis
--------
.. parsed-literal::
#define BOOST_MPL_ASSERT_MSG( condition, message, types ) \\
|unspecified-token-seq| \\
/\*\*/
Description
-----------
Generates a compilation error with an embedded custom message when the condition
doesn't hold.
Header
------
.. parsed-literal::
#include <boost/mpl/assert.hpp>
Parameters
----------
+---------------+-----------------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================================+===============================================+
| ``condition`` | An integral constant expression | A condition to be asserted. |
+---------------+-----------------------------------+-----------------------------------------------+
| ``message`` | A legal identifier token | A custom message in a form of a legal C++ |
| | | identifier token. |
+---------------+-----------------------------------+-----------------------------------------------+
| ``types`` | A legal function parameter list | A parenthized list of types to be displayed |
| | | in the error message. |
+---------------+-----------------------------------+-----------------------------------------------+
Expression semantics
--------------------
For any integral constant expression ``expr``, legal C++ identifier ``message``, and
arbitrary types ``t1``, ``t2``,... ``tn``:
.. parsed-literal::
BOOST_MPL_ASSERT_MSG( expr, message, (t1, t2,... tn) );
:Return type:
None.
:Precondition:
``t1``, ``t2``,... ``tn`` are non-``void``.
:Semantics:
Generates a compilation error if ``expr::value != true``, otherwise
has no effect.
When possible within the compiler's diagnostic capabilities,
the error message will include the ``message`` identifier and the parenthized
list of ``t1``, ``t2``,... ``tn`` types, and have a general form of:
.. parsed-literal::
|...| \*\*\*\*\*\*\*\*\*\*\*\*( |...|::message )\*\*\*\*\*\*\*\*\*\*\*\*)(t1, t2,... tn) |...|
.. parsed-literal::
BOOST_MPL_ASSERT_MSG( expr, message, (types<t1, t2,... tn>) );
:Return type:
None.
:Precondition:
None.
:Semantics:
Generates a compilation error if ``expr::value != true``, otherwise
has no effect.
When possible within the compiler's diagnostics capabilities,
the error message will include the ``message`` identifier and the list of
``t1``, ``t2``,... ``tn`` types, and have a general form of:
.. parsed-literal::
|...| \*\*\*\*\*\*\*\*\*\*\*\*( |...|::message )\*\*\*\*\*\*\*\*\*\*\*\*)(types<t1, t2,... tn>) |...|
Example
-------
::
template< typename T > struct my
{
// ...
BOOST_MPL_ASSERT_MSG(
is_integral<T>::value
, NON_INTEGRAL_TYPES_ARE_NOT_ALLOWED
, (T)
);
};
my<void*> test;
// In instantiation of `my<void*>':
// instantiated from here
// conversion from `
// mpl_::failed************(my<void*>::
// NON_INTEGRAL_TYPES_ARE_NOT_ALLOWED::************)(void*)
// ' to non-scalar type `mpl_::assert<false>' requested
See also
--------
|Asserts|, |BOOST_MPL_ASSERT|, |BOOST_MPL_ASSERT_NOT|, |BOOST_MPL_ASSERT_RELATION|
-91
View File
@@ -1,91 +0,0 @@
.. Macros/Asserts//BOOST_MPL_ASSERT_NOT
BOOST_MPL_ASSERT_NOT
====================
Synopsis
--------
.. parsed-literal::
#define BOOST_MPL_ASSERT_NOT( pred ) \\
|unspecified-token-seq| \\
/\*\*/
Description
-----------
Generates a compilation error when predicate holds true.
Header
------
.. parsed-literal::
#include <boost/mpl/assert.hpp>
Parameters
----------
+---------------+-----------------------------------+-------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================================+===========================================+
| ``pred`` | Boolean nullary |Metafunction| | A predicate to be asserted to be false. |
+---------------+-----------------------------------+-------------------------------------------+
Expression semantics
--------------------
For any boolean nullary |Metafunction| ``pred``:
.. parsed-literal::
BOOST_MPL_ASSERT_NOT(( pred ));
:Return type:
None.
:Semantics:
Generates a compilation error if ``pred::type::value != false``, otherwise
has no effect. Note that double parentheses are required even if no commas
appear in the condition.
When possible within the compiler's diagnostic capabilities,
the error message will include the predicate's full type name, and have a
general form of:
.. parsed-literal::
|...| \*\*\*\*\*\*\*\*\*\*\*\*boost::mpl::not_< pred >::\*\*\*\*\*\*\*\*\*\*\*\* |...|
Example
-------
::
template< typename T, typename U > struct my
{
// ...
BOOST_MPL_ASSERT_NOT(( is_same< T,U > ));
};
my<void,void> test;
// In instantiation of `my<void, void>':
// instantiated from here
// conversion from `
// mpl_::failed************boost::mpl::not_<boost::is_same<void, void>
// >::************' to non-scalar type `mpl_::assert<false>' requested
See also
--------
|Asserts|, |BOOST_MPL_ASSERT|, |BOOST_MPL_ASSERT_MSG|, |BOOST_MPL_ASSERT_RELATION|
-98
View File
@@ -1,98 +0,0 @@
.. Macros/Asserts//BOOST_MPL_ASSERT_RELATION
BOOST_MPL_ASSERT_RELATION
=========================
Synopsis
--------
.. parsed-literal::
#define BOOST_MPL_ASSERT_RELATION( x, relation, y ) \\
|unspecified-token-seq| \\
/\*\*/
Description
-----------
A specialized assertion macro for checking numerical conditions. Generates
a compilation error when the condition ``( x relation y )``
doesn't hold.
Header
------
.. parsed-literal::
#include <boost/mpl/assert.hpp>
Parameters
----------
+---------------+-----------------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================================+===============================================+
| ``x`` | An integral constant | Left operand of the checked relation. |
+---------------+-----------------------------------+-----------------------------------------------+
| ``y`` | An integral constant | Right operand of the checked relation. |
+---------------+-----------------------------------+-----------------------------------------------+
| ``relation`` | A C++ operator token | An operator token for the relation being |
| | | checked. |
+---------------+-----------------------------------+-----------------------------------------------+
Expression semantics
--------------------
For any integral constants ``x``, ``y`` and a legal C++ operator token ``op``:
.. parsed-literal::
BOOST_MPL_ASSERT_RELATION( x, op, y );
:Return type:
None.
:Semantics:
Generates a compilation error if ``( x op y ) != true``, otherwise
has no effect.
When possible within the compiler's diagnostic capabilities,
the error message will include a name of the relation being checked,
the actual values of both operands, and have a general form of:
.. parsed-literal::
|...| \*\*\*\*\*\*\*\*\*\*\*\*\ |...|\ assert_relation<op, x, y>::\*\*\*\*\*\*\*\*\*\*\*\*) |...|
Example
-------
::
template< typename T, typename U > struct my
{
// ...
BOOST_MPL_ASSERT_RELATION( sizeof(T), <, sizeof(U) );
};
my<char[50],char[10]> test;
// In instantiation of `my<char[50], char[10]>':
// instantiated from here
// conversion from `
// mpl_::failed************mpl_::assert_relation<less, 50, 10>::************'
// to non-scalar type `mpl_::assert<false>' requested
See also
--------
|Asserts|, |BOOST_MPL_ASSERT|, |BOOST_MPL_ASSERT_NOT|, |BOOST_MPL_ASSERT_MSG|
-101
View File
@@ -1,101 +0,0 @@
.. Macros/Broken Compiler Workarounds//BOOST_MPL_AUX_LAMBDA_SUPPORT
BOOST_MPL_AUX_LAMBDA_SUPPORT
============================
Synopsis
--------
.. parsed-literal::
#define BOOST_MPL_AUX_LAMBDA_SUPPORT(arity, fun, params) \\
|unspecified-token-seq| \\
/\*\*/
Description
-----------
Enables metafunction ``fun`` for the use in |Lambda Expression|\ s on
compilers that don't support partial template specialization or/and
template template parameters. Expands to nothing on conforming compilers.
Header
------
.. parsed-literal::
#include <boost/mpl/aux\_/lambda_support.hpp>
Parameters
----------
+---------------+-------------------------------+---------------------------------------------------+
| Parameter | Requirement | Description |
+===============+===============================+===================================================+
| ``arity`` | An integral constant | The metafunction's arity, i.e. the number of its |
| | | template parameters, including the defaults. |
+---------------+-------------------------------+---------------------------------------------------+
| ``fun`` | A legal identifier token | The metafunction's name. |
+---------------+-------------------------------+---------------------------------------------------+
| ``params`` | A |PP-tuple| | A tuple of the metafunction's parameter names, in |
| | | their original order, including the defaults. |
+---------------+-------------------------------+---------------------------------------------------+
Expression semantics
--------------------
For any integral constant ``n``, a |Metafunction| ``fun``, and arbitrary types |A1...An|:
.. parsed-literal::
template< typename A1,\ |...| typename A\ *n* > struct fun
{
// |...|
BOOST_MPL_AUX_LAMBDA_SUPPORT(n, fun, (A1,\ |...|\ A\ *n*\ ))
};
:Precondition:
Appears in ``fun``\ 's scope, immediately followed by the scope-closing
bracket (``}``).
:Return type:
None.
:Semantics:
Expands to nothing and has no effect on conforming compilers. On compilers that
don't support partial template specialization or/and template template parameters
expands to an unspecified token sequence enabling ``fun`` to participate in
|Lambda Expression|\ s with the semantics described in this manual.
Example
-------
.. parsed-literal::
template< typename T, typename U = int > struct f
{
typedef T type[sizeof(U)];
BOOST_MPL_AUX_LAMBDA_SUPPORT(2, f, (T,U))
};
typedef apply\ ``1``\< f<char,_1>,long >::type r;
BOOST_MPL_ASSERT(( is_same< r, char[sizeof(long)] > ));
See also
--------
|Macros|, |Metafunctions|, |Lambda Expression|
.. |PP-tuple| replace:: `PP-tuple`__
__ http://www.boost.org/libs/preprocessor/doc/data/tuples.html
-6
View File
@@ -1,6 +0,0 @@
The format and language of this reference documentation has been greatly influenced by
the SGI's `Standard Template Library Programmer's Guide`__.
__ http://www.sgi.com/tech/stl/
@@ -1,19 +0,0 @@
Iteration algorithms are the basic building blocks behind many of the
MPL's algorithms, and are usually the first place to look at when
starting to build a new one. Abstracting away the details of sequence
iteration and employing various optimizations such as recursion
unrolling, they provide significant advantages over a hand-coded
approach.
.. Of all of iteration algorithms, ``iter_fold_if`` is the
most complex and at the same time the most fundamental. The rest of
the algorithms from the category |--| ``iter_fold``, ``reverse_iter_fold``,
``fold``, and ``reverse_fold`` |--| simply provide a more high-level
(and more restricted) interface to the core ``iter_fold_if``
functionality [#performace]_.
.. [#performace] That's not to say that they are *implemented*
through ``iter_fold_if`` |--| they are often not, in particular
because the restricted functionality allows for more
optimizations.
@@ -1,2 +0,0 @@
.. |Querying Algorithms| replace:: `Querying Algorithms`_
@@ -1,24 +0,0 @@
According to their name, MPL's *transformation*, or *sequence-building
algorithms* provide the tools for building new sequences from the existing
ones by performing some kind of transformation. A typical transformation
alogrithm takes one or more input sequences and a transformation
metafunction/predicate, and returns a new sequence built according to the
algorithm's semantics through the means of its |Inserter| argument, which
plays a role similar to the role of run-time |Output Iterator|.
.. Say something about optionality of Inserters/their default behavior
Every transformation algorithm is a |Reversible Algorithm|, providing
an accordingly named ``reverse_`` counterpart carrying the transformation
in the reverse order. Thus, all sequence-building algorithms come in pairs,
for instance ``replace`` / ``reverse_replace``. In presence of variability of
the output sequence's properties such as front or backward extensibility,
the existence of the bidirectional algorithms allows for the most efficient
way to perform the required transformation.
.. |Transformation Algorithms| replace:: `Transformation Algorithms`_
.. |transformation algorithm| replace:: `transformation algorithm`_
.. _transformation algorithm: `Transformation Algorithms`_
.. |transformation algorithms| replace:: `transformation algorithms`_
-40
View File
@@ -1,40 +0,0 @@
The MPL provides a broad range of fundamental algorithms aimed to
satisfy the majority of sequential compile-time data processing
needs. The algorithms include compile-time counterparts
of many of the STL algorithms, iteration algorithms borrowed from
functional programming languages, and more.
Unlike the algorithms in the C++ Standard Library, which operate on
implict *iterator ranges*, the majority of MPL counterparts take
and return *sequences*. This derivation is not dictated by the
functional nature of C++ compile-time computations per se, but
rather by a desire to improve general usability of the library,
making programming with compile-time data structures as enjoyable
as possible.
.. This can be seen as a further generalization and extension of
the STL's conceptual framework.
In the spirit of the STL, MPL algorithms are *generic*, meaning
that they are not tied to particular sequence class
implementations, and can operate on a wide range of arguments as
long as they satisfy the documented requirements. The requirements
are formulated in terms of concepts. Under the hood,
algorithms are decoupled from concrete sequence
implementations by operating on |iterators|.
All MPL algorithms can be sorted into three
major categories: iteration algorithms, querying algorithms, and
transformation algorithms. The transformation algorithms introduce
an associated |Inserter| concept, a rough equivalent for the notion of
|Output Iterator| in the Standard Library. Moreover, every
transformation algorithm provides a ``reverse_`` counterpart,
allowing for a wider range of efficient transformations |--| a
common functionality documented by the |Reversible Algorithm|
concept.
.. |Output Iterator| replace:: `Output Iterator <http://www.sgi.com/tech/stl/OutputIterator.html>`_
.. |sequence algorithms| replace:: `sequence algorithms`__
__ `Algorithms`_
-116
View File
@@ -1,116 +0,0 @@
.. Sequences/Concepts//Associative Sequence |70
Associative Sequence
====================
Description
-----------
An |Associative Sequence| is a |Forward Sequence| that allows efficient retrieval of
elements based on keys. Unlike associative containers in the C++ Standard Library,
MPL associative sequences have no associated ordering relation. Instead,
*type identity* is used to impose an equivalence relation on keys, and the
order in which sequence elements are traversed during iteration is left
unspecified.
Definitions
-----------
.. _`key-part`:
.. _`value-part`:
* A *key* is a part of the element type used to identify and retrieve
the element within the sequence.
* A *value* is a part of the element type retrievied from the sequence
by its key.
Expression requirements
-----------------------
|In the following table...| ``s`` is an |Associative Sequence|,
``x`` is a sequence element, and ``k`` and ``def`` are arbitrary types.
In addition to the requirements defined in |Forward Sequence|,
the following must be met:
+-------------------------------+-----------------------------------+---------------------------+
| Expression | Type | Complexity |
+===============================+===================================+===========================+
| ``has_key<s,k>::type`` | Boolean |Integral Constant| | Amortized constant time |
+-------------------------------+-----------------------------------+---------------------------+
| ``count<s,k>::type`` | |Integral Constant| | Amortized constant time |
+-------------------------------+-----------------------------------+---------------------------+
| ``order<s,k>::type`` | |Integral Constant| or ``void_`` | Amortized constant time |
+-------------------------------+-----------------------------------+---------------------------+
| ``at<s,k>::type`` | Any type | Amortized constant time |
+-------------------------------+-----------------------------------+---------------------------+
| ``at<s,k,def>::type`` | Any type | Amortized constant time |
+-------------------------------+-----------------------------------+---------------------------+
| ``key_type<s,x>::type`` | Any type | Amortized constant time |
+-------------------------------+-----------------------------------+---------------------------+
| ``value_type<s,x>::type`` | Any type | Amortized constant time |
+-------------------------------+-----------------------------------+---------------------------+
Expression semantics
--------------------
|Semantics disclaimer...| |Forward Sequence|.
+-------------------------------+---------------------------------------------------------------+
| Expression | Semantics |
+===============================+===============================================================+
| ``has_key<s,k>::type`` | |true if and only if| there is one or more |
| | elements with the key ``k`` in ``s``; see |has_key|. |
+-------------------------------+---------------------------------------------------------------+
| ``count<s,k>::type`` | The number of elements with the key ``k`` in ``s``; |
| | see |count|. |
+-------------------------------+---------------------------------------------------------------+
| ``order<s,k>::type`` | A unique unsigned |Integral Constant| associated |
| | with the key ``k`` in the sequence ``s``; see |order|. |
+-------------------------------+---------------------------------------------------------------+
| .. parsed-literal:: | The first element associated with the key ``k`` |
| | in the sequence ``s``; see |at|. |
| at<s,k>::type | |
| at<s,k,def>::type | |
+-------------------------------+---------------------------------------------------------------+
| ``key_type<s,x>::type`` | The key part of the element ``x`` that would be |
| | used to identify ``x`` in ``s``; see |key_type|. |
+-------------------------------+---------------------------------------------------------------+
| ``value_type<s,x>::type`` | The value part of the element ``x`` that would be |
| | used for ``x`` in ``s``; see |value_type|. |
+-------------------------------+---------------------------------------------------------------+
.. Invariants
----------
For any associative sequence ``s`` the following invariants always hold:
* ???
Models
------
* |set|
* |map|
.. * |multiset|
See also
--------
|Sequences|, |Extensible Associative Sequence|, |has_key|, |count|, |order|, |at|, |key_type|, |value_type|
.. |key| replace:: `key`__
__ `key-part`_
.. |value| replace:: `value`__
__ `value-part`_
@@ -1,64 +0,0 @@
.. Sequences/Concepts//Back Extensible Sequence |60
Back Extensible Sequence
========================
Description
-----------
A |Back Extensible Sequence| is an |Extensible Sequence| that supports amortized constant
time insertion and removal operations at the end.
Refinement of
-------------
|Extensible Sequence|
Expression requirements
-----------------------
In addition to the requirements defined in |Extensible Sequence|,
for any |Back Extensible Sequence| ``s`` the following must be met:
+-------------------------------+-------------------------------+---------------------------+
| Expression | Type | Complexity |
+===============================+===============================+===========================+
| ``push_back<s,x>::type`` | |Back Extensible Sequence| | Amortized constant time |
+-------------------------------+-------------------------------+---------------------------+
| ``pop_back<s>::type`` | |Back Extensible Sequence| | Amortized constant time |
+-------------------------------+-------------------------------+---------------------------+
| ``back<s>::type`` | Any type | Amortized constant time |
+-------------------------------+-------------------------------+---------------------------+
Expression semantics
--------------------
|Semantics disclaimer...| |Extensible Sequence|.
+-------------------------------+-----------------------------------------------------------+
| Expression | Semantics |
+===============================+===========================================================+
| ``push_back<s,x>::type`` | Equivalent to ``insert<s,end<s>::type,x>::type``; |
| | see |push_back|. |
+-------------------------------+-----------------------------------------------------------+
| ``pop_back<v>::type`` | Equivalent to ``erase<s,end<s>::type>::type``; |
| | see |pop_back|. |
+-------------------------------+-----------------------------------------------------------+
| ``back<s>::type`` | The last element in the sequence; see |back|. |
+-------------------------------+-----------------------------------------------------------+
Models
------
* |vector|
* |deque|
See also
--------
|Sequences|, |Extensible Sequence|, |Front Extensible Sequence|, |push_back|, |pop_back|, |back|
@@ -1,77 +0,0 @@
.. Iterators/Concepts//Bidirectional Iterator |20
Bidirectional Iterator
======================
Description
-----------
A |Bidirectional Iterator| is a |Forward Iterator| that provides a way to
obtain an iterator to the previous element in a sequence.
Refinement of
-------------
|Forward Iterator|
Definitions
-----------
* a bidirectional iterator ``i`` is `decrementable` if there is a "previous"
iterator, that is, if ``prior<i>::type`` expression is well-defined;
iterators pointing to the first element of the sequence are not
decrementable.
Expression requirements
-----------------------
In addition to the requirements defined in |Forward Iterator|,
the following requirements must be met.
+-----------------------+-------------------------------------------+---------------------------+
| Expression | Type | Complexity |
+=======================+===========================================+===========================+
| ``next<i>::type`` | |Bidirectional Iterator| | Amortized constant time |
+-----------------------+-------------------------------------------+---------------------------+
| ``prior<i>::type`` | |Bidirectional Iterator| | Amortized constant time |
+-----------------------+-------------------------------------------+---------------------------+
| ``i::category`` | |Integral Constant|, convertible | Constant time |
| | to ``bidirectional_iterator_tag`` | |
+-----------------------+-------------------------------------------+---------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef prior<i>::type j;
:Precondition:
``i`` is decrementable
:Semantics:
``j`` is an iterator pointing to the previous element of the
sequence
:Postcondition:
``j`` is dereferenceable and incrementable
Invariants
----------
For any bidirectional iterators ``i`` and ``j`` the following invariants
always hold:
* If ``i`` is incrementable, then ``prior< next<i>::type >::type`` is a null
operation; similarly, if ``i`` is decrementable, ``next< prior<i>::type >::type``
is a null operation.
See also
--------
|Iterators|, |Forward Iterator|, |Random Access Iterator|, |Bidirectional Sequence|, |prior|
@@ -1,58 +0,0 @@
.. Sequences/Concepts//Bidirectional Sequence |20
Bidirectional Sequence
======================
Description
-----------
A |Bidirectional Sequence| is a |Forward Sequence| whose iterators model
|Bidirectional Iterator|.
Refinement of
-------------
|Forward Sequence|
Expression requirements
-----------------------
In addition to the requirements defined in |Forward Sequence|,
for any |Bidirectional Sequence| ``s`` the following must be met:
+---------------------------+-----------------------------------+---------------------------+
| Expression | Type | Complexity |
+===========================+===================================+===========================+
| ``begin<s>::type`` | |Bidirectional Iterator| | Amortized constant time |
+---------------------------+-----------------------------------+---------------------------+
| ``end<s>::type`` | |Bidirectional Iterator| | Amortized constant time |
+---------------------------+-----------------------------------+---------------------------+
| ``back<s>::type`` | Any type | Amortized constant time |
+---------------------------+-----------------------------------+---------------------------+
Expression semantics
--------------------
|Semantics disclaimer...| |Forward Sequence|.
+---------------------------+-----------------------------------------------------------------------+
| Expression | Semantics |
+===========================+=======================================================================+
| ``back<s>::type`` | The last element in the sequence; see |back|. |
+---------------------------+-----------------------------------------------------------------------+
Models
------
* |vector|
* |range_c|
See also
--------
|Sequences|, |Forward Sequence|, |Random Access Sequence|, |Bidirectional Iterator|, |begin| / |end|, |back|
-27
View File
@@ -1,27 +0,0 @@
.. Macros/Configuration//BOOST_MPL_CFG_NO_HAS_XXX |20
BOOST_MPL_CFG_NO_HAS_XXX
========================
Synopsis
--------
.. parsed-literal::
// #define BOOST_MPL_CFG_NO_HAS_XXX
Description
-----------
``BOOST_MPL_CFG_NO_HAS_XXX`` is an boolean configuration macro
signaling availability of the |BOOST_MPL_HAS_XXX_TRAIT_DEF| /
|BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF| introspection macros' functionality
on a particular compiler.
See also
--------
|Macros|, |Configuration|, |BOOST_MPL_HAS_XXX_TRAIT_DEF|, |BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF|
-39
View File
@@ -1,39 +0,0 @@
.. Macros/Configuration//BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS |10
BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
=====================================
.. _`BOOST_MPL_CFG_NO_PREPROCESSED`:
Synopsis
--------
.. parsed-literal::
// #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
Description
-----------
``BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS`` is an boolean configuration macro
regulating library's internal use of preprocessed headers. When defined, it
instructs the MPL to discard the pre-generated headers found in
``boost/mpl/aux_/preprocessed`` directory and use `preprocessor
metaprogramming`__ techniques to generate the necessary versions of the
library components on the fly.
In this implementation of the library, the macro is not defined by default.
To change the default configuration, define
``BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS`` before including any library
header.
__ http://boost-consulting.com/tmpbook/preprocessor.html
See also
--------
|Macros|, |Configuration|
.. |preprocessed headers| replace:: `preprocessed headers`__
__ `BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS`_
-12
View File
@@ -1,12 +0,0 @@
.. _`Categorized`:
Concepts
////////
.. include:: concepts.gen
Components
//////////
.. include:: index.gen
-4
View File
@@ -1,4 +0,0 @@
.. _`Data`:
.. |Data Types| replace:: `Data Types`_
@@ -1,87 +0,0 @@
.. Sequences/Concepts//Extensible Associative Sequence |80
Extensible Associative Sequence
===============================
Description
-----------
An |Extensible Associative Sequence| is an |Associative Sequence| that supports
insertion and removal of elements. In contrast to |Extensible Sequence|,
|Extensible Associative Sequence| does not provide a mechanism for
inserting an element at a specific position.
Expression requirements
-----------------------
|In the following table...| ``s`` is an |Associative Sequence|,
``pos`` is an iterator into ``s``, and ``x`` and ``k`` are arbitrary types.
In addition to the |Associative Sequence| requirements, the following must be met:
+-------------------------------+---------------------------------------+---------------------------+
| Expression | Type | Complexity |
+===============================+=======================================+===========================+
| ``insert<s,x>::type`` | |Extensible Associative Sequence| | Amortized constant time |
+-------------------------------+---------------------------------------+---------------------------+
| ``insert<s,pos,x>::type`` | |Extensible Associative Sequence| | Amortized constant time |
+-------------------------------+---------------------------------------+---------------------------+
| ``erase_key<s,k>::type`` | |Extensible Associative Sequence| | Amortized constant time |
+-------------------------------+---------------------------------------+---------------------------+
| ``erase<s,pos>::type`` | |Extensible Associative Sequence| | Amortized constant time |
+-------------------------------+---------------------------------------+---------------------------+
| ``clear<s>::type`` | |Extensible Associative Sequence| | Amortized constant time |
+-------------------------------+---------------------------------------+---------------------------+
Expression semantics
--------------------
|Semantics disclaimer...| |Associative Sequence|.
+-------------------------------+-------------------------------------------------------------------+
| Expression | Semantics |
+===============================+===================================================================+
| ``insert<s,x>::type`` | Inserts ``x`` into ``s``; the resulting sequence ``r`` is |
| | equivalent to ``s`` except that |
| | :: |
| | |
| | at< r, key_type<s,x>::type >::type |
| | |
| | is identical to ``value_type<s,x>::type``; see |insert|. |
+-------------------------------+-------------------------------------------------------------------+
| ``insert<s,pos,x>::type`` | Equivalent to ``insert<s,x>::type``; ``pos`` is ignored; |
| | see |insert|. |
+-------------------------------+-------------------------------------------------------------------+
| ``erase_key<s,k>::type`` | Erases elements in ``s`` associated with the key ``k``; |
| | the resulting sequence ``r`` is equivalent to ``s`` except |
| | that ``has_key<r,k>::value == false``; see |erase_key|. |
+-------------------------------+-------------------------------------------------------------------+
| ``erase<s,pos>::type`` | Erases the element at a specific position; equivalent to |
| | ``erase_key<s, deref<pos>::type >::type``; see |erase|. |
+-------------------------------+-------------------------------------------------------------------+
| ``clear<s>::type`` | An empty sequence concept-identical to ``s``; see |
| | |clear|. |
+-------------------------------+-------------------------------------------------------------------+
.. Invariants
----------
For any extensible associative sequence ``s`` the following invariants always hold:
Models
------
* |set|
* |map|
.. * |multiset|
See also
--------
|Sequences|, |Associative Sequence|, |insert|, |erase|, |clear|
-77
View File
@@ -1,77 +0,0 @@
.. Sequences/Concepts//Extensible Sequence |40
Extensible Sequence
===================
Description
-----------
An |Extensible Sequence| is a sequence that supports insertion and removal of
elements. Extensibility is orthogonal to sequence traversal characteristics.
Expression requirements
-----------------------
For any |Extensible Sequence| ``s``, its iterators ``pos`` and ``last``,
|Forward Sequence| ``r``, and any type ``x``, the following expressions must
be valid:
+-----------------------------------+---------------------------+---------------------------+
| Expression | Type | Complexity |
+===================================+===========================+===========================+
| ``insert<s,pos,x>::type`` | |Extensible Sequence| | Unspecified |
+-----------------------------------+---------------------------+---------------------------+
| ``insert_range<s,pos,r>::type`` | |Extensible Sequence| | Unspecified |
+-----------------------------------+---------------------------+---------------------------+
| ``erase<s,pos>::type`` | |Extensible Sequence| | Unspecified |
+-----------------------------------+---------------------------+---------------------------+
| ``erase<s,pos,last>::type`` | |Extensible Sequence| | Unspecified |
+-----------------------------------+---------------------------+---------------------------+
| ``clear<s>::type`` | |Extensible Sequence| | Constant time |
+-----------------------------------+---------------------------+---------------------------+
Expression semantics
--------------------
+-----------------------------------+---------------------------------------------------------------+
| Expression | Semantics |
+===================================+===============================================================+
| ``insert<s,pos,x>::type`` | A new sequence, concept-identical to ``s``, of |
| | the following elements: |
| | [``begin<s>::type``, ``pos``), ``x``, |
| | [``pos``, ``end<s>::type``); see |insert|. |
+-----------------------------------+---------------------------------------------------------------+
| ``insert_range<s,pos,r>::type`` | A new sequence, concept-identical to ``s``, of |
| | the following elements: |
| | [``begin<s>::type``, ``pos``), |
| | [``begin<r>::type``, ``end<r>::type``), |
| | [``pos``, ``end<s>::type``); see |insert_range|. |
+-----------------------------------+---------------------------------------------------------------+
| ``erase<s,pos>::type`` | A new sequence, concept-identical to ``s``, of |
| | the following elements: |
| | [``begin<s>::type``, ``pos``), |
| | [``next<pos>::type``, ``end<s>::type``); see |erase|. |
+-----------------------------------+---------------------------------------------------------------+
| ``erase<s,pos,last>::type`` | A new sequence, concept-identical to ``s``, of |
| | the following elements: |
| | [``begin<s>::type``, ``pos``), |
| | [``last``, ``end<s>::type``); see |erase|. |
+-----------------------------------+---------------------------------------------------------------+
| ``clear<s>::type`` | An empty sequence concept-identical to ``s``; see |
| | |clear|. |
+-----------------------------------+---------------------------------------------------------------+
Models
------
* |vector|
* |list|
See also
--------
|Sequences|, |Back Extensible Sequence|, |insert|, |insert_range|, |erase|, |clear|
-125
View File
@@ -1,125 +0,0 @@
.. Iterators/Concepts//Forward Iterator |10
Forward Iterator
================
Description
-----------
A |Forward Iterator| ``i`` is a type that represents a positional reference
to an element of a |Forward Sequence|. It allows to access the element through
a dereference operation, and provides a way to obtain an iterator to
the next element in a sequence.
.. A [Forward Iterator] guarantees a linear traversal over
the sequence.
Definitions
-----------
* An iterator can be `dereferenceable`, meaning that ``deref<i>::type``
is a well-defined expression.
* An iterator is `past-the-end` if it points beyond the last element of a
sequence; past-the-end iterators are non-dereferenceable.
* An iterator ``i`` is `incrementable` if there is a "next" iterator, that
is, if ``next<i>::type`` expression is well-defined; past-the-end iterators are
not incrementable.
* Two iterators into the same sequence are `equivalent` if they have the same
type.
* An iterator ``j`` is `reachable` from an iterator ``i`` if , after recursive
application of ``next`` metafunction to ``i`` a finite number of times, ``i``
is equivalent to ``j``.
* The notation [``i``,\ ``j``) refers to a `range` of iterators beginning with
``i`` and up to but not including ``j``.
* The range [``i``,\ ``j``) is a `valid range` if ``j`` is reachable from ``i``.
Expression requirements
-----------------------
+-----------------------+-------------------------------------------+---------------------------+
| Expression | Type | Complexity |
+=======================+===========================================+===========================+
| ``deref<i>::type`` | Any type | Amortized constant time |
+-----------------------+-------------------------------------------+---------------------------+
| ``next<i>::type`` | |Forward Iterator| | Amortized constant time |
+-----------------------+-------------------------------------------+---------------------------+
| ``i::category`` | |Integral Constant|, convertible | Constant time |
| | to ``forward_iterator_tag`` | |
+-----------------------+-------------------------------------------+---------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef deref<i>::type j;
:Precondition:
``i`` is dereferenceable
:Semantics:
``j`` is identical to the type of the pointed element
.. ..........................................................................
.. parsed-literal::
typedef next<i>::type j;
:Precondition:
``i`` is incrementable
:Semantics:
``j`` is the next iterator in a sequence
:Postcondition:
``j`` is dereferenceable or past-the-end
.. ..........................................................................
.. parsed-literal::
typedef i::category c;
:Semantics:
``c`` is identical to the iterator's category tag
Invariants
----------
For any forward iterators ``i`` and ``j`` the following invariants always hold:
* ``i`` and ``j`` are equivalent if and only if they are pointing to the same
element.
* If ``i`` is dereferenceable, and ``j`` is equivalent to ``i``, then ``j`` is
dereferenceable as well.
* If ``i`` and ``j`` are equivalent and dereferenceable, then ``deref<i>::type``
and ``deref<j>::type`` are identical.
* If ``i`` is incrementable, and ``j`` is equivalent to ``i``, then ``j`` is
incrementable as well.
* If ``i`` and ``j`` are equivalent and incrementable, then ``next<i>::type``
and ``next<j>::type`` are equivalent.
See also
--------
|Iterators|, |Bidirectional Iterator|, |Forward Sequence|, |deref|, |next|
-91
View File
@@ -1,91 +0,0 @@
.. Sequences/Concepts//Forward Sequence |10
Forward Sequence
================
Description
-----------
A |Forward Sequence| is an MPL concept representing a compile-time sequence of
elements. Sequence elements are
types, and are accessible through |iterators|. The |begin| and |end| metafunctions
provide iterators delimiting the range of the sequence
elements. A sequence guarantees that its elements are arranged in a definite,
but possibly unspecified, order. Every MPL sequence is a |Forward Sequence|.
Definitions
-----------
* The *size* of a sequence is the number of elements it contains. The size is a
nonnegative number.
* A sequence is *empty* if its size is zero.
Expression requirements
-----------------------
For any |Forward Sequence| ``s`` the following expressions must be valid:
+---------------------------+-----------------------------------+---------------------------+
| Expression | Type | Complexity |
+===========================+===================================+===========================+
| ``begin<s>::type`` | |Forward Iterator| | Amortized constant time |
+---------------------------+-----------------------------------+---------------------------+
| ``end<s>::type`` | |Forward Iterator| | Amortized constant time |
+---------------------------+-----------------------------------+---------------------------+
| ``size<s>::type`` | |Integral Constant| | Unspecified |
+---------------------------+-----------------------------------+---------------------------+
| ``empty<s>::type`` | Boolean |Integral Constant| | Constant time |
+---------------------------+-----------------------------------+---------------------------+
| ``front<s>::type`` | Any type | Amortized constant time |
+---------------------------+-----------------------------------+---------------------------+
Expression semantics
--------------------
+---------------------------+-----------------------------------------------------------------------+
| Expression | Semantics |
+===========================+=======================================================================+
| ``begin<s>::type`` | An iterator to the first element of the sequence; see |begin|. |
+---------------------------+-----------------------------------------------------------------------+
| ``end<s>::type`` | A past-the-end iterator to the sequence; see |end|. |
+---------------------------+-----------------------------------------------------------------------+
| ``size<s>::type`` | The size of the sequence; see |size|. |
+---------------------------+-----------------------------------------------------------------------+
| ``empty<s>::type`` | |true if and only if| the sequence is empty; see |empty|. |
+---------------------------+-----------------------------------------------------------------------+
| ``front<s>::type`` | The first element in the sequence; see |front|. |
+---------------------------+-----------------------------------------------------------------------+
Invariants
----------
For any |Forward Sequence| ``s`` the following invariants always hold:
* [``begin<s>::type``, ``end<s>::type``) is always a valid range.
* An algorithm that iterates through the range [``begin<s>::type``, ``end<s>::type``)
will pass through every element of ``s`` exactly once.
* ``begin<s>::type`` is identical to ``end<s>::type`` if and only if ``s`` is empty.
* Two different iterations through ``s`` will access its elements in the same order.
Models
------
* |vector|
* |map|
* |range_c|
* |iterator_range|
* |filter_view|
See also
--------
|Sequences|, |Bidirectional Sequence|, |Forward Iterator|, |begin| / |end|, |size|, |empty|, |front|
@@ -1,64 +0,0 @@
.. Sequences/Concepts//Front Extensible Sequence |50
Front Extensible Sequence
=========================
Description
-----------
A |Front Extensible Sequence| is an |Extensible Sequence| that supports amortized constant
time insertion and removal operations at the beginning.
Refinement of
-------------
|Extensible Sequence|
Expression requirements
-----------------------
In addition to the requirements defined in |Extensible Sequence|,
for any |Back Extensible Sequence| ``s`` the following must be met:
+-------------------------------+-------------------------------+---------------------------+
| Expression | Type | Complexity |
+===============================+===============================+===========================+
| ``push_front<s,x>::type`` | |Front Extensible Sequence| | Amortized constant time |
+-------------------------------+-------------------------------+---------------------------+
| ``pop_front<s>::type`` | |Front Extensible Sequence| | Amortized constant time |
+-------------------------------+-------------------------------+---------------------------+
| ``front<s>::type`` | Any type | Amortized constant time |
+-------------------------------+-------------------------------+---------------------------+
Expression semantics
--------------------
|Semantics disclaimer...| |Extensible Sequence|.
+-------------------------------+-----------------------------------------------------------+
| Expression | Semantics |
+===============================+===========================================================+
| ``push_front<s,x>::type`` | Equivalent to ``insert<s,begin<s>::type,x>::type``; |
| | see |push_front|. |
+-------------------------------+-----------------------------------------------------------+
| ``pop_front<v>::type`` | Equivalent to ``erase<s,begin<s>::type>::type``; |
| | see |pop_front|. |
+-------------------------------+-----------------------------------------------------------+
| ``front<s>::type`` | The first element in the sequence; see |front|. |
+-------------------------------+-----------------------------------------------------------+
Models
------
* |vector|
* |list|
See also
--------
|Sequences|, |Extensible Sequence|, |Back Extensible Sequence|, |push_front|, |pop_front|, |front|
-116
View File
@@ -1,116 +0,0 @@
.. Macros/Introspection//BOOST_MPL_HAS_XXX_TRAIT_DEF
BOOST_MPL_HAS_XXX_TRAIT_DEF
===========================
Synopsis
--------
.. parsed-literal::
#define BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \\
|unspecified-token-seq| \\
/\*\*/
Description
-----------
Expands into a definition of a boolean unary |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 type memeber ``x::name``.
On the deficient compilers not capabale of performing the detection,
``has_name<x>::value`` always returns ``false``. A boolean configuraion
macro, |BOOST_MPL_CFG_NO_HAS_XXX|, is provided to signal or override
the "deficient" status of a particular compiler.
|Note:| |BOOST_MPL_HAS_XXX_TRAIT_DEF| is a simplified front end to
the |BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF| introspection macro |-- end note|
Header
------
.. parsed-literal::
#include <boost/mpl/has_xxx.hpp>
Parameters
----------
+---------------+-------------------------------+---------------------------------------------------+
| Parameter | Requirement | Description |
+===============+===============================+===================================================+
| ``name`` | A legal identifier token | A name of the member being detected. |
+---------------+-------------------------------+---------------------------------------------------+
Expression semantics
--------------------
For any legal C++ identifier ``name``:
.. parsed-literal::
BOOST_MPL_HAS_XXX_TRAIT_DEF(name)
:Precondition:
Appears at namespace scope.
:Return type:
None.
:Semantics:
Equivalent to
.. parsed-literal::
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(
BOOST_PP_CAT(has\_,name), name, false
)
Example
-------
.. parsed-literal::
BOOST_MPL_HAS_XXX_TRAIT_DEF(xxx)
struct test1 {};
struct test2 { void xxx(); };
struct test3 { int xxx; };
struct test4 { static int xxx(); };
struct test5 { template< typename T > struct xxx {}; };
struct test6 { typedef int xxx; };
struct test7 { struct xxx; };
struct test8 { typedef void (\*xxx)(); };
struct test9 { typedef void (xxx)(); };
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> ));
#if !defined(BOOST_MPL_CFG_NO_HAS_XXX)
BOOST_MPL_ASSERT(( has_xxx<test6> ));
BOOST_MPL_ASSERT(( has_xxx<test7> ));
BOOST_MPL_ASSERT(( has_xxx<test8> ));
BOOST_MPL_ASSERT(( has_xxx<test9> ));
#endif
BOOST_MPL_ASSERT(( has_xxx<test6,true\_> ));
BOOST_MPL_ASSERT(( has_xxx<test7,true\_> ));
BOOST_MPL_ASSERT(( has_xxx<test8,true\_> ));
BOOST_MPL_ASSERT(( has_xxx<test9,true\_> ));
See also
--------
|Macros|, |BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF|, |BOOST_MPL_CFG_NO_HAS_XXX|
@@ -1,153 +0,0 @@
.. Macros/Introspection//BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF
=================================
Synopsis
--------
.. parsed-literal::
#define BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(trait, name, default\_) \\
|unspecified-token-seq| \\
/\*\*/
Description
-----------
Expands into a definition of a boolean unary |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 type memeber ``x::name``.
On the deficient compilers not capabale of performing the detection,
``trait<x>::value`` always returns a fallback value ``default_``.
A boolean configuraion macro, |BOOST_MPL_CFG_NO_HAS_XXX|, 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
------
.. parsed-literal::
#include <boost/mpl/has_xxx.hpp>
Parameters
----------
+---------------+-------------------------------+---------------------------------------------------+
| Parameter | Requirement | Description |
+===============+===============================+===================================================+
| ``trait`` | A legal identifier token | A name of the metafunction to be generated. |
+---------------+-------------------------------+---------------------------------------------------+
| ``name`` | A legal identifier token | A name of the member being detected. |
+---------------+-------------------------------+---------------------------------------------------+
| ``default_`` | An boolean constant | A fallback value for the deficient compilers. |
+---------------+-------------------------------+---------------------------------------------------+
Expression semantics
--------------------
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_TRAIT_NAMED_DEF(trait, name, c1)
:Precondition:
Appears at namespace scope.
:Return type:
None.
:Semantics:
Expands into an equivalent of the following class template definition
.. parsed-literal::
template< typename X, typename fallback = boost::mpl::bool_<c1> >
struct trait
{
// |unspecified|
// ...
};
where ``trait`` is a boolean |Metafunction| with the following semantics:
.. parsed-literal::
typedef trait<x>::type r;
:Return type:
|Integral Constant|.
:Semantics:
If |BOOST_MPL_CFG_NO_HAS_XXX| is defined, ``r::value == c1``;
otherwise, ``r::value == true`` if and only if ``x`` is a class type
that has a nested type memeber ``x::name``.
.. parsed-literal::
typedef trait< x,c2 >::type r;
:Return type:
|Integral Constant|.
:Semantics:
If |BOOST_MPL_CFG_NO_HAS_XXX| is defined, ``r::value == c2::value``;
otherwise, equivalent to
.. parsed-literal::
typedef trait<x>::type r;
Example
-------
.. parsed-literal::
BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(has_xxx, xxx, false)
struct test1 {};
struct test2 { void xxx(); };
struct test3 { int xxx; };
struct test4 { static int xxx(); };
struct test5 { template< typename T > struct xxx {}; };
struct test6 { typedef int xxx; };
struct test7 { struct xxx; };
struct test8 { typedef void (\*xxx)(); };
struct test9 { typedef void (xxx)(); };
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> ));
#if !defined(BOOST_MPL_CFG_NO_HAS_XXX)
BOOST_MPL_ASSERT(( has_xxx<test6> ));
BOOST_MPL_ASSERT(( has_xxx<test7> ));
BOOST_MPL_ASSERT(( has_xxx<test8> ));
BOOST_MPL_ASSERT(( has_xxx<test9> ));
#endif
BOOST_MPL_ASSERT(( has_xxx<test6,true\_> ));
BOOST_MPL_ASSERT(( has_xxx<test7,true\_> ));
BOOST_MPL_ASSERT(( has_xxx<test8,true\_> ));
BOOST_MPL_ASSERT(( has_xxx<test9,true\_> ));
See also
--------
|Macros|, |BOOST_MPL_HAS_XXX_TRAIT_DEF|, |BOOST_MPL_CFG_NO_HAS_XXX|
-75
View File
@@ -1,75 +0,0 @@
.. Algorithms/Concepts//Inserter
Inserter
========
Description
-----------
An |Inserter| is a compile-time substitute for STL |Output Iterator|.
Under the hood, it's simply a type holding
two entities: a *state* and an *operation*. When passed to a
|transformation algorithm|, the inserter's binary operation is
invoked for every element that would normally be written into the
output iterator, with the element itself (as the second
argument) and the result of the previous operation's invocation |--| or,
for the very first element, the inserter's initial state.
Technically, instead of taking a single inserter parameter,
|transformation algorithms| could accept the state and the "output"
operation separately. Grouping these in a single parameter entity,
however, brings the algorithms semantically and syntactically closer to
their STL counterparts, significantly simplifying many of the common
use cases.
Valid expressions
-----------------
|In the following table...| ``in`` is a model of |Inserter|.
+-----------------------+-------------------------------+
| Expression | Type |
+=======================+===============================+
| ``in::state`` | Any type |
+-----------------------+-------------------------------+
| ``in::operation`` | Binary |Lambda Expression| |
+-----------------------+-------------------------------+
Expression semantics
--------------------
+-----------------------+-------------------------------------------+
| Expression | Semantics |
+=======================+===========================================+
| ``in::state`` | The inserter's initial state. |
+-----------------------+-------------------------------------------+
| ``in::operation`` | The inserter's "output" operation. |
+-----------------------+-------------------------------------------+
Example
-------
.. parsed-literal::
typedef transform<
range_c<int,0,10>
, plus<_1,_1>
, back_inserter< vector0<> >
>::type result;
Models
------
* |inserter|
* |front_inserter|
* |back_inserter|
See also
--------
|Algorithms|, |Transformation Algorithms|, |inserter|, |front_inserter|, |back_inserter|
-71
View File
@@ -1,71 +0,0 @@
.. Data Types/Concepts//Integral Constant
Integral Constant
=================
Description
-----------
An |Integral Constant| is a holder class for a compile-time value of an
integral type. Every |Integral Constant| is also a nullary |Metafunction|,
returning itself. An integral constant *object* is implicitly convertible to the
corresponding run-time value of the wrapped integral type.
Expression requirements
-----------------------
|In the following table...| ``n`` is a model of |Integral Constant|.
+-----------------------------------+---------------------------------------+---------------------------+
| Expression | Type | Complexity |
+===================================+=======================================+===========================+
| ``n::value_type`` | An integral type | Constant time. |
+-----------------------------------+---------------------------------------+---------------------------+
| ``n::value`` | An integral constant expression | Constant time. |
+-----------------------------------+---------------------------------------+---------------------------+
| ``n::type`` | |Integral Constant| | Constant time. |
+-----------------------------------+---------------------------------------+---------------------------+
| ``next<n>::type`` | |Integral Constant| | Constant time. |
+-----------------------------------+---------------------------------------+---------------------------+
| ``prior<n>::type`` | |Integral Constant| | Constant time. |
+-----------------------------------+---------------------------------------+---------------------------+
| ``n::value_type const c = n()`` | | Constant time. |
+-----------------------------------+---------------------------------------+---------------------------+
Expression semantics
--------------------
+---------------------------------------+-----------------------------------------------------------+
| Expression | Semantics |
+=======================================+===========================================================+
| ``n::value_type`` | A cv-unqualified type of ``n::value``. |
+---------------------------------------+-----------------------------------------------------------+
| ``n::value`` | The value of the wrapped integral constant. |
+---------------------------------------+-----------------------------------------------------------+
| ``n::type`` | ``is_same<n::type,n>::value == true``. |
+---------------------------------------+-----------------------------------------------------------+
| ``next<n>::type`` | An |Integral Constant| ``c`` of type ``n::value_type`` |
| | such that ``c::value == n::value + 1``. |
+---------------------------------------+-----------------------------------------------------------+
| ``prior<n>::type`` | An |Integral Constant| ``c`` of type ``n::value_type`` |
| | such that ``c::value == n::value - 1``. |
+---------------------------------------+-----------------------------------------------------------+
| ``n::value_type const c = n()`` | ``c == n::value``. |
+---------------------------------------+-----------------------------------------------------------+
Models
------
* |bool_|
* |int_|
* |long_|
* |integral_c|
See also
--------
|Data Types|, |Integral Sequence Wrapper|, |integral_c|
@@ -1,116 +0,0 @@
.. Sequences/Concepts//Integral Sequence Wrapper |90
Integral Sequence Wrapper
=========================
Description
-----------
An |Integral Sequence Wrapper| is a class template that provides a concise
interface for creating a corresponding sequence of |Integral Constant|\ s. In
particular, assuming that ``seq`` is a name of the wrapper's underlying
sequence and |c1...cn| are integral constants of an integral type ``T`` to
be stored in the sequence, the wrapper provides us with the following
notation:
.. line-block::
``seq_c<T``,\ |c1...cn|\ ``>``
If ``seq`` is a |Variadic Sequence|, *numbered* wrapper forms are
also avaialable:
.. line-block::
``seq``\ *n*\ ``_c<T``,\ |c1...cn|\ ``>``
Expression requirements
-----------------------
|In the following table...| ``seq`` is a placeholder token for the
|Integral Sequence Wrapper|'s underlying sequence's name.
.. |seq_c| replace:: ``seq_c<T``,\ |c1...cn|
.. |seqn_c| replace:: ``seq``\ *n*\ ``_c<T``,\ |c1...cn|
+-------------------------------+-----------------------+---------------------------+
| Expression | Type | Complexity |
+===============================+=======================+===========================+
| |seq_c|\ ``>`` | |Forward Sequence| | Amortized constant time. |
+-------------------------------+-----------------------+---------------------------+
| |seq_c|\ ``>::type`` | |Forward Sequence| | Amortized constant time. |
+-------------------------------+-----------------------+---------------------------+
| |seq_c|\ ``>::value_type`` | An integral type | Amortized constant time. |
+-------------------------------+-----------------------+---------------------------+
| |seqn_c|\ ``>`` | |Forward Sequence| | Amortized constant time. |
+-------------------------------+-----------------------+---------------------------+
| |seqn_c|\ ``>::type`` | |Forward Sequence| | Amortized constant time. |
+-------------------------------+-----------------------+---------------------------+
| |seqn_c|\ ``>::value_type`` | An integral type | Amortized constant time. |
+-------------------------------+-----------------------+---------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef seq_c<T,\ |c1...cn|> s;
typedef seq\ *n*\ _c<T,\ |c1...cn|> s;
:Semantics:
``s`` is a sequence ``seq`` of integral constant wrappers ``integral_c<T,``\ |c1|\ ``>``,
``integral_c<T,``\ |c2|\ ``>``, ... ``integral_c<T,``\ |cn|\ ``>``.
:Postcondition:
``size<s>::value == n``.
.. .. parsed-literal::
BOOST_MPL_ASSERT_RELATION(( at_c<v,0>::type::value,==,\ |c1| ));
BOOST_MPL_ASSERT_RELATION(( at_c<v,1>::type::value,==,\ |c2| ));
...
BOOST_MPL_ASSERT_RELATION(( at_c<v,\ *n*>::type::value,==,\ |cn| ));
.. ..........................................................................
.. parsed-literal::
typedef seq_c<T,\ |c1...cn|>::type s;
typedef seq\ *n*\ _c<T,\ |c1...cn|>::type s;
:Semantics:
``s`` is identical to
``seq``\ *n*\ ``<``\ ``integral_c<T,``\ |c1|\ ``>``,\ ``integral_c<T,``\ |c2|\ ``>``,
... ``integral_c<T,``\ |cn|\ ``>`` ``>``.
.. ..........................................................................
.. parsed-literal::
typedef seq_c<T,\ |c1...cn|>::value_type t;
typedef seq\ *n*\ _c<T,\ |c1...cn|>::value_type t;
:Semantics:
``is_same<t,T>::value == true``.
Models
------
* |vector_c|
* |list_c|
* |set_c|
See also
--------
|Sequences|, |Variadic Sequence|, |Integral Constant|
-15
View File
@@ -1,15 +0,0 @@
All iterators in MPL are classified into three iterator concepts, or
`categories`, named according to the type of traversal provided. The
categories are: |Forward Iterator|, |Bidirectional Iterator|, and
|Random Access Iterator|. The concepts are hierarchical:
|Random Access Iterator| is a refinement of |Bidirectional Iterator|,
which, in its turn, is a refinement of |Forward Iterator|.
Because of the inherently immutable nature of the value access, MPL
iterators escape the problems of the traversal-only categorization
discussed at length in [n1550]_.
.. [n1550] http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2003/n1550.htm
@@ -1,7 +0,0 @@
From the implementation standpoint, iterators are almost-opaque types which
guarantee to provide us with the only memeber that we can access directly:
their category. Incrementing, dereferencing and the rest of iterator
functionality is available to us through the accosiated iterator
metafunctions.
-14
View File
@@ -1,14 +0,0 @@
Iterators are generic means of addressing a particular element or a range
of sequential elements in a sequence. They are also a mechanism that makes
it possible to decouple `algorithms`__ from concrete compile-time `sequence
implementations`__. Under the hood, all MPL sequence algorithms are
implemented in terms of iterators. In particular, that means that they
will work on any custom compile-time sequence, given that the appropriate
iterator inteface is provided.
__ `Algorithms`_
__ `label-Sequences-Classes`_
.. Analogy with STL iterators?
.. More?
-49
View File
@@ -1,49 +0,0 @@
.. Macros/Configuration//BOOST_MPL_LIMIT_LIST_SIZE |40
BOOST_MPL_LIMIT_LIST_SIZE
=========================
Synopsis
--------
.. parsed-literal::
#if !defined(BOOST_MPL_LIMIT_LIST_SIZE)
# define BOOST_MPL_LIMIT_LIST_SIZE \\
|idic| \\
/\*\*/
#endif
Description
-----------
``BOOST_MPL_LIMIT_LIST_SIZE`` is an overridable configuration macro regulating
the maximum arity of the ``list``\ 's and ``list_c``\ 's |variadic forms|. In this
implementation of the library, ``BOOST_MPL_LIMIT_LIST_SIZE`` has a default value
of 20. To override the default limit, define ``BOOST_MPL_LIMIT_LIST_SIZE`` to
the desired maximum arity rounded up to the nearest multiple of ten before
including any library header. |preprocessed headers disclaimer|
Example
-------
.. parsed-literal::
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_LIST_SIZE 10
``#``\ include <boost/mpl/list.hpp>
using namespace boost::mpl;
typedef list_c<int,1> l_1;
typedef list_c<int,1,2,3,4,5,6,7,8,9,10> l_10;
// typedef list_c<int,1,2,3,4,5,6,7,8,9,10,11> l_11; // error!
See also
--------
|Configuration|, |BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS|, |BOOST_MPL_LIMIT_VECTOR_SIZE|
-58
View File
@@ -1,58 +0,0 @@
.. Macros/Configuration//BOOST_MPL_LIMIT_MAP_SIZE |60
BOOST_MPL_LIMIT_MAP_SIZE
========================
Synopsis
--------
.. parsed-literal::
#if !defined(BOOST_MPL_LIMIT_MAP_SIZE)
# define BOOST_MPL_LIMIT_MAP_SIZE \\
|idic| \\
/\*\*/
#endif
Description
-----------
``BOOST_MPL_LIMIT_MAP_SIZE`` is an overridable configuration macro regulating
the maximum arity of the ``map``\ 's `variadic form`__. In this
implementation of the library, ``BOOST_MPL_LIMIT_MAP_SIZE`` has a default value
of 20. To override the default limit, define ``BOOST_MPL_LIMIT_MAP_SIZE`` to
the desired maximum arity rounded up to the nearest multiple of ten before
including any library header. |preprocessed headers disclaimer|
__ `Variadic Sequence`_
Example
-------
.. parsed-literal::
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_MAP_SIZE 10
``#``\ include <boost/mpl/map.hpp>
``#``\ include <boost/mpl/pair.hpp>
``#``\ include <boost/mpl/int.hpp>
using namespace boost::mpl;
template< int i > struct ints : pair< int_<i>,int_<i> > {};
typedef map< ints<1> > m_1;
typedef map< ints<1>, ints<2>, ints<3>, ints<4>, ints<5>
ints<6>, ints<7>, ints<8>, ints<9>, ints<10> > m_10;
// typedef map< ints<1>, ints<2>, ints<3>, ints<4>, ints<5>
// ints<6>, ints<7>, ints<8>, ints<9>, ints<10>, ints<11> > m_11; // error!
See also
--------
|Configuration|, |BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS|, |BOOST_MPL_LIMIT_SET_SIZE|
@@ -1,62 +0,0 @@
.. Macros/Configuration//BOOST_MPL_LIMIT_METAFUNCTION_ARITY |20
BOOST_MPL_LIMIT_METAFUNCTION_ARITY
==================================
Synopsis
--------
.. parsed-literal::
#if !defined(BOOST_MPL_LIMIT_METAFUNCTION_ARITY)
# define BOOST_MPL_LIMIT_METAFUNCTION_ARITY \\
|idic| \\
/\*\*/
#endif
Description
-----------
``BOOST_MPL_LIMIT_METAFUNCTION_ARITY`` is an overridable configuration macro
regulating the maximum supported arity of `metafunctions`__ and
`metafunction classes`__. In this implementation of the
library, ``BOOST_MPL_LIMIT_METAFUNCTION_ARITY`` has a default value of 5. To
override the default limit, define ``BOOST_MPL_LIMIT_METAFUNCTION_ARITY`` to
the desired maximum arity before including any library header.
|preprocessed headers disclaimer|
__ `Metafunction`_
__ `Metafunction Class`_
Example
-------
.. parsed-literal::
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_METAFUNCTION_ARITY 2
``#``\ include <boost/mpl/apply.hpp>
using namespace boost::mpl;
template< typename T1, typename T2 > struct second
{
typedef T2 type;
};
template< typename T1, typename T2, typename T3 > struct third
{
typedef T3 type;
};
typedef apply< second<_1,_2_>,int,long >::type r1;
// typedef apply< third<_1,_2_,_3>,int,long,float >::type r2; // error!
See also
--------
|Macros|, |Configuration|, |BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS|
-48
View File
@@ -1,48 +0,0 @@
.. Macros/Configuration//BOOST_MPL_LIMIT_SET_SIZE |50
BOOST_MPL_LIMIT_SET_SIZE
========================
Synopsis
--------
.. parsed-literal::
#if !defined(BOOST_MPL_LIMIT_SET_SIZE)
# define BOOST_MPL_LIMIT_SET_SIZE \\
|idic| \\
/\*\*/
#endif
Description
-----------
``BOOST_MPL_LIMIT_SET_SIZE`` is an overridable configuration macro regulating
the maximum arity of the ``set``\ 's and ``set_c``\ 's |variadic forms|. In this
implementation of the library, ``BOOST_MPL_LIMIT_SET_SIZE`` has a default value
of 20. To override the default limit, define ``BOOST_MPL_LIMIT_SET_SIZE`` to
the desired maximum arity rounded up to the nearest multiple of ten before
including any library header. |preprocessed headers disclaimer|
Example
-------
.. parsed-literal::
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_SET_SIZE 10
``#``\ include <boost/mpl/set.hpp>
using namespace boost::mpl;
typedef set_c<int,1> s_1;
typedef set_c<int,1,2,3,4,5,6,7,8,9,10> s_10;
// typedef set_c<int,1,2,3,4,5,6,7,8,9,10,11> s_11; // error!
See also
--------
|Configuration|, |BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS|, |BOOST_MPL_LIMIT_MAP_SIZE|
-38
View File
@@ -1,38 +0,0 @@
.. Macros/Configuration//BOOST_MPL_LIMIT_UNROLLING |70
BOOST_MPL_LIMIT_UNROLLING
=========================
Synopsis
--------
.. parsed-literal::
#if !defined(BOOST_MPL_LIMIT_UNROLLING)
# define BOOST_MPL_LIMIT_UNROLLING \\
|idic| \\
/\*\*/
#endif
Description
-----------
``BOOST_MPL_LIMIT_UNROLLING`` is an overridable configuration macro regulating
the unrolling depth of the library's iteration algorithms. In this implementation
of the library, ``BOOST_MPL_LIMIT_UNROLLING`` has a default value of 4. To
override the default, define ``BOOST_MPL_LIMIT_UNROLLING`` to the desired
value before including any library header.
|preprocessed headers disclaimer|
Example
-------
Except for overall library performace, overriding the
``BOOST_MPL_LIMIT_UNROLLING``\ 's default value has no user-observable effects.
See also
--------
|Configuration|, |BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS|
-49
View File
@@ -1,49 +0,0 @@
.. Macros/Configuration//BOOST_MPL_LIMIT_VECTOR_SIZE |30
BOOST_MPL_LIMIT_VECTOR_SIZE
===========================
Synopsis
--------
.. parsed-literal::
#if !defined(BOOST_MPL_LIMIT_VECTOR_SIZE)
# define BOOST_MPL_LIMIT_VECTOR_SIZE \\
|idic| \\
/\*\*/
#endif
Description
-----------
``BOOST_MPL_LIMIT_VECTOR_SIZE`` is an overridable configuration macro regulating
the maximum arity of the ``vector``\ 's and ``vector_c``\ 's |variadic forms|. In this
implementation of the library, ``BOOST_MPL_LIMIT_VECTOR_SIZE`` has a default value
of 20. To override the default limit, define ``BOOST_MPL_LIMIT_VECTOR_SIZE`` to
the desired maximum arity rounded up to the nearest multiple of ten before
including any library header. |preprocessed headers disclaimer|
Example
-------
.. parsed-literal::
#define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
#define BOOST_MPL_LIMIT_VECTOR_SIZE 10
``#``\ include <boost/mpl/vector.hpp>
using namespace boost::mpl;
typedef vector_c<int,1> v_1;
typedef vector_c<int,1,2,3,4,5,6,7,8,9,10> v_10;
// typedef vector_c<int,1,2,3,4,5,6,7,8,9,10,11> v_11; // error!
See also
--------
|Configuration|, |BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS|, |BOOST_MPL_LIMIT_LIST_SIZE|
-37
View File
@@ -1,37 +0,0 @@
.. Metafunctions/Concepts//Lambda Expression |30
Lambda Expression
=================
Description
-----------
A |Lambda Expression| is a compile-time invocable entity in either of the following two
forms:
* |Metafunction Class|
* |Placeholder Expression|
Most of the MPL components accept either of those, and the concept
gives us a consice way to describe these requirements.
Expression requirements
-----------------------
See corresponding |Metafunction Class| and |Placeholder Expression| specifications.
Models
------
* |always|
* |unpack_args|
* ``plus<_, int_<2> >``
* ``if_< less<_1, int_<7> >, plus<_1,_2>, _1 >``
See also
--------
|Metafunctions|, |Placeholders|, |apply|, |lambda|
-10
View File
@@ -1,10 +0,0 @@
The MPL supplies a suite of static assertion macros that are specifically
designed to generate maximally useful and informative error messages
within the diagnostic capabilities of each compiler.
All assert macros can be used at class, function, or namespace scope.
.. |Asserts| replace:: `Asserts`_
@@ -1,2 +0,0 @@
.. |Configuration| replace:: `Configuration`_
-18
View File
@@ -1,18 +0,0 @@
Being a *template* metaprogramming framework, the MPL concentrates on
getting one thing done well and leaves most of the clearly
preprocessor-related tasks to the corresponding specialized
libraries [PRE]_, [Ve03]_. But whether we like it or not, macros play
an important role on today's C++ metaprogramming, and some of
the useful MPL-level functionality cannot be implemented
without leaking its preprocessor-dependent implementation
nature into the library's public interface.
.. [PRE] Vesa Karvonen, Paul Mensonides,
`The Boost Preprocessor Metaprogramming library`__
__ http://www.boost.org/libs/preprocessor/doc/index.html
.. [Ve03] Vesa Karvonen, `The Order Programming Language`, 2003.
-97
View File
@@ -1,97 +0,0 @@
.. Metafunctions/Concepts//Metafunction |10
Metafunction
============
Description
-----------
.. _`nullary-metafunction`:
A *metafunction* is a class or a class template that represents a
function invocable at compile-time. An non-nullary metafunction is
invoked by instantiating the class template with particular
template parameters (metafunction arguments); the result of the
metafunction application is accessible through the instantiation's
nested ``type`` typedef. All metafunction's arguments must be types
(i.e. only *type template parameters* are allowed). A metafunction
can have a variable number of parameters. A *nullary metafunction* is
represented as a (template) class with a nested ``type`` typename
member.
.. |nullary metafunction| replace:: `nullary-metafunction`_
Expression requirements
-----------------------
|In the following table...| ``f`` is a |Metafunction|.
+-------------------------------+-----------------------+---------------------------+
| Expression | Type | Complexity |
+===============================+=======================+===========================+
| ``f::type`` | Any type | Unspecified. |
+-------------------------------+-----------------------+---------------------------+
| ``f<>::type`` | Any type | Unspecified. |
+-------------------------------+-----------------------+---------------------------+
| ``f<a1,..,an>::type`` | Any type | Unspecified. |
+-------------------------------+-----------------------+---------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef f::type x;
:Precondition:
``f`` is a nullary |Metafunction|; ``f::type`` is a *type-name*.
:Semantics:
``x`` is the result of the metafunction invocation.
.. ...................................................................................
.. parsed-literal::
typedef f<>::type x;
:Precondition:
``f`` is a nullary |Metafunction|; ``f<>::type`` is a *type-name*.
:Semantics:
``x`` is the result of the metafunction invocation.
.. ...................................................................................
.. parsed-literal::
typedef f<a1,\ |...| \a\ *n*\>::type x;
:Precondition:
``f`` is an *n*-ary |Metafunction|; |a1...an| are types;
``f<a1,...an>::type`` is a *type-name*.
:Semantics:
``x`` is the result of the metafunction invocation
with the actual arguments |a1...an|.
Models
------
* |identity|
* |plus|
* |begin|
* |insert|
* |fold|
See also
--------
|Metafunctions|, |Metafunction Class|, |Lambda Expression|, |Invocation|, |apply|, |lambda|, |bind|
-86
View File
@@ -1,86 +0,0 @@
.. Metafunctions/Concepts//Metafunction Class |20
Metafunction Class
==================
Summary
-------
A *metafunction class* is a certain form of metafunction representation
that enables higher-order metaprogramming. More precisely, it's a class
with a publicly-accessible nested |metafunction| called ``apply``.
Correspondingly, a metafunction class invocation is defined as invocation
of its nested ``apply`` metafunction.
Expression requirements
-----------------------
|In the following table...| ``f`` is a |Metafunction Class|.
+-------------------------------+---------------------------+---------------------------+
| Expression | Type | Complexity |
+===============================+===========================+===========================+
| ``f::apply::type`` | Any type | Unspecified. |
+-------------------------------+---------------------------+---------------------------+
| ``f::apply<>::type`` | Any type | Unspecified. |
+-------------------------------+---------------------------+---------------------------+
| ``f::apply<a1,...an>::type`` | Any type | Unspecified. |
+-------------------------------+---------------------------+---------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef f::apply::type x;
:Precondition:
``f`` is a nullary |Metafunction Class|; ``f::apply::type`` is a *type-name*.
:Semantics:
``x`` is the result of the metafunction class invocation.
.. ...................................................................................
.. parsed-literal::
typedef f::apply<>::type x;
:Precondition:
``f`` is a nullary |Metafunction Class|; ``f::apply<>::type`` is a *type-name*.
:Semantics:
``x`` is the result of the metafunction class invocation.
.. ...................................................................................
.. parsed-literal::
typedef f::apply<a1,\ |...|\ a\ *n*\>::type x;
:Precondition:
``f`` is an *n*-ary metafunction class; ``apply`` is a |Metafunction|.
:Semantics:
``x`` is the result of the metafunction class
invocation with the actual arguments |a1...an|.
Models
------
* |always|
* |arg|
* |quote|
* |numeric_cast|
* |unpack_args|
See also
--------
|Metafunctions|, |Metafunction|, |Lambda Expression|, |Invocation|, |apply_wrap|, |bind|, |quote|
@@ -1,5 +0,0 @@
.. |Arithmetic Operations| replace:: `Arithmetic Operations`_
.. |arithmetic| replace:: `arithmetic`__
__ `Arithmetic Operations`_
@@ -1,5 +0,0 @@
.. |Bitwise Operations| replace:: `Bitwise Operations`_
.. |bitwise| replace:: `bitwise`__
__ `Bitwise Operations`_
@@ -1,5 +0,0 @@
.. |Comparisons| replace:: `Comparisons`_
.. |comparison| replace:: `comparison`__
__ `Comparisons`_
@@ -1,7 +0,0 @@
.. |Composition and Argument Binding| replace:: `Composition and Argument Binding`_
.. |composition| replace:: `composition`__
.. |argument binding| replace:: `argument binding`__
__ `Composition and Argument Binding`_
__ `Composition and Argument Binding`_
@@ -1,3 +0,0 @@
.. |control flow| replace:: `control flow`__
__ `Control Flow`_
@@ -1,3 +0,0 @@
.. |invocation| replace:: `invocation`__
__ `Invocation`_
@@ -1,6 +0,0 @@
.. |logical| replace:: `logical`__
__ `Logical Operations`_
.. |Logical Operations| replace:: `Logical Operations`_
.. |logical operations| replace:: `logical operations`_
@@ -1,61 +0,0 @@
The MPL provides a number of |Trivial Metafunction|\ s that a nothing more than
thin wrappers for a differently-named class nested type members. While important
in the context of `in-place metafunction composition`__, these metafunctions have
so little to them that presenting them in the same format as the rest of the
compoments in this manual would result in more boilerplate syntactic baggage than
the actual content. To avoid this problem, we instead factor out the common
metafunctions' requirements into the `corresponding concept`__ and gather all of
them in a single place |--| this subsection |--| in a compact table form that is
presented below.
__ `Composition and Argument Binding`_
__ `Trivial Metafunction`_
Trivial Metafunctions Summary
=============================
In the following table, ``x`` is an arbitrary class type.
.. |first| replace:: |``first``|__
.. |``first``| replace:: :refentry:`first`
__ `trivial-first`_
.. |second| replace:: |``second``|__
.. |``second``| replace:: :refentry:`second`
__ `trivial-second`_
.. |base| replace:: |``base``|__
.. |``base``| replace:: :refentry:`base`
__ `trivial-base`_
.. _`trivial-first`:
.. _`trivial-second`:
.. _`trivial-base`:
+---------------------------+-------------------------------------------+
| Metafunction | Header |
+===========================+===========================================+
| ``first<x>::type`` | ``#include <boost/mpl/pair.hpp>`` |
+---------------------------+-------------------------------------------+
| ``second<x>::type`` | ``#include <boost/mpl/pair.hpp>`` |
+---------------------------+-------------------------------------------+
| ``base<x>::type`` | ``#include <boost/mpl/base.hpp>`` |
+---------------------------+-------------------------------------------+
See Also
--------
|Metafunctions|, |Trivial Metafunction|
.. |Trivial Metafunctions| replace:: `Trivial Metafunctions`__
__ `Trivial`_
-3
View File
@@ -1,3 +0,0 @@
.. |type selection| replace:: `type selection`__
__ `Type Selection`_
-51
View File
@@ -1,51 +0,0 @@
The MPL includes a number of predefined metafunctions that can be roughly
classified in two categories: `general purpose metafunctions`, dealing with
conditional |type selection| and higher-order metafunction |invocation|,
|composition|, and |argument binding|, and `numeric metafunctions`,
incapsulating built-in and user-defined |arithmetic|, |comparison|,
|logical|, and |bitwise| operations.
Given that it is possible to perform integer numeric computations at
compile time using the conventional operators notation, the need for the
second category might be not obvious, but it in fact plays a cental role in
making programming with MPL seemingly effortless. In
particular, there are at least two contexts where built-in language
facilities fall short [#portability]_\ :
1) Passing a computation to an algorithm.
2) Performing a computation on non-integer data.
The second use case deserves special attention. In contrast to the built-in,
strictly integer compile-time arithmetics, the MPL numeric metafunctions are
*polymorphic*, with support for *mixed-type arithmetics*. This means that they
can operate on a variety of numeric types |--| for instance, rational,
fixed-point or complex numbers, |--| and that, in general, you are allowed to
freely intermix these types within a single expression. See |Numeric
Metafunction| concept for more details on the MPL numeric infrastructure.
.. The provided `infrastructure`__ allows easy plugging of user-defined numeric
types
Naturally, they also , meaning that you can perform a computation on the
arguments of different types, and the result will yeild the largest/most general
of them. For user-defined numeric types, they provide an `infrastructure`__ that
allows easy plugging and seemless integration with predefined library
types. details.
__ `Numeric Metafunction`_
To reduce a negative syntactical impact of the metafunctions notation
over the infix operator notation, all numeric metafunctions
allow to pass up to N arguments, where N is defined by the value of
|BOOST_MPL_LIMIT_METAFUNCTION_ARITY| configuration macro.
.. [#portability] All other considerations aside, as of the time of this writing
(early 2004), using built-in operators on integral constants still often
present a portability problem |--| many compilers cannot handle particular
forms of expressions, forcing us to use conditional compilation. Because MPL
numeric metafunctions work on types and encapsulate these kind of workarounds
internally, they elude these problems, so if you aim for portability, it is
generally adviced to use them in the place of the conventional operators, even
at the price of slightly decreased readability.
-139
View File
@@ -1,139 +0,0 @@
.. Metafunctions/Concepts//Numeric Metafunction |60
Numeric Metafunction
====================
Description
-----------
A |Numeric Metafunction| is a |tag dispatched metafunction| that provides
a built-in infrastructure for easy implementation of mixed-type operations.
Expression requirements
-----------------------
|In the following table...| ``op`` is a placeholder token for the actual
|Numeric Metafunction|'s name, and ``x``, ``y`` and |x1...xn| are
arbitrary numeric types.
+-------------------------------------------+-----------------------+---------------------------+
| Expression | Type | Complexity |
+===========================================+=======================+===========================+
|``op_tag<x>::type`` | |Integral Constant| | Amortized constant time. |
+-------------------------------------------+-----------------------+---------------------------+
| .. parsed-literal:: | Any type | Unspecified. |
| | | |
| op_impl< | | |
| op_tag<x>::type | | |
| , op_tag<y>::type | | |
| >::apply<x,y>::type | | |
+-------------------------------------------+-----------------------+---------------------------+
|``op<``\ |x1...xn|\ ``>::type`` | Any type | Unspecified. |
+-------------------------------------------+-----------------------+---------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef op_tag<x>::type tag;
:Semantics:
``tag`` is a tag type for ``x`` for ``op``.
``tag::value`` is ``x``\ 's *conversion rank*.
.. ..........................................................................
.. parsed-literal::
typedef op_impl<
op_tag<x>::type
, op_tag<y>::type
>::apply<x,y>::type r;
:Semantics:
``r`` is the result of ``op`` application on arguments ``x``
and ``y``.
.. ..........................................................................
.. parsed-literal::
typedef op<\ |x1...xn|\ >::type r;
:Semantics:
``r`` is the result of ``op`` application on arguments |x1...xn|.
Example
-------
.. parsed-literal::
struct complex_tag : int_<10> {};
template< typename Re, typename Im > struct complex
{
typedef complex_tag tag;
typedef complex type;
typedef Re real;
typedef Im imag;
};
template< typename C > struct real : C::real {};
template< typename C > struct imag : C::imag {};
namespace boost { namespace mpl {
template<>
struct plus_impl< complex_tag,complex_tag >
{
template< typename N1, typename N2 > struct apply
: complex<
plus< typename N1::real, typename N2::real >
, plus< typename N1::imag, typename N2::imag >
>
{
};
};
}}
typedef complex< int_<5>, int_<-1> > c1;
typedef complex< int_<-5>, int_<1> > c2;
typedef plus<c1,c2> r1;
BOOST_MPL_ASSERT_RELATION( real<r1>::value, ==, 0 );
BOOST_MPL_ASSERT_RELATION( imag<r1>::value, ==, 0 );
typedef plus<c1,c1> r2;
BOOST_MPL_ASSERT_RELATION( real<r2>::value, ==, 10 );
BOOST_MPL_ASSERT_RELATION( imag<r2>::value, ==, -2 );
typedef plus<c2,c2> r3;
BOOST_MPL_ASSERT_RELATION( real<r3>::value, ==, -10 );
BOOST_MPL_ASSERT_RELATION( imag<r3>::value, ==, 2 );
Models
------
* |plus|
* |minus|
* |times|
* |divides|
See also
--------
|Tag Dispatched Metafunction|, |Metafunctions|, |numeric_cast|
@@ -1,44 +0,0 @@
.. Metafunctions/Concepts//Placeholder Expression |40
Placeholder Expression
======================
Description
-----------
A |Placeholder Expression| is a type that is either a |placeholder| or a class
template specialization with at least one argument that itself is a
|Placeholder Expression|.
Expression requirements
-----------------------
If ``X`` is a class template, and ``a1``,... ``an`` are arbitrary types, then
``X<a1,...,an>`` is a |Placeholder Expression| if and only if all of the following
conditions hold:
* At least one of the template arguments ``a1``,... ``an`` is a |placeholder|
or a |Placeholder Expression|.
* All of ``X``\ 's template parameters, including the default ones, are types.
* The number of ``X``\ 's template parameters, including the default ones, is
less or equal to the value of ``BOOST_MPL_LIMIT_METAFUNCTION_ARITY``
`configuration macro`__.
__ `Configuration`_
Models
------
* |_1|
* ``plus<_, int_<2> >``
* ``if_< less<_1, int_<7> >, plus<_1,_2>, _1 >``
See also
--------
|Lambda Expression|, |Placeholders|, |Metafunctions|, |apply|, |lambda|
-95
View File
@@ -1,95 +0,0 @@
.. Metafunctions/Composition and Argument Binding//_1,_2,..._n |10
Placeholders
============
Synopsis
--------
.. parsed-literal::
namespace placeholders {
typedef |unspecified| _;
typedef arg<1> _1;
typedef arg<2> _2;
|...|
typedef arg<\ *n*\ > _\ *n*\ ;
}
using placeholders::_;
using placeholders::_1;
using placeholders::_2;
|...|
using placeholders::_\ *n*\ ;
Description
-----------
A placeholder in a form ``_``\ *n* is simply a synonym for the corresponding
``arg<n>`` specialization. The unnamed placeholder ``_`` (underscore) carries
`special meaning`__ in bind and lambda expressions, and does not have
defined semantics outside of these contexts.
Placeholder names can be made available in the user namespace through
``using namespace mpl::placeholders;`` directive.
__ `bind semantics`_
Header
------
.. parsed-literal::
#include <boost/mpl/placeholders.hpp>
|Note:| The include might be omitted when using placeholders to construct a |Lambda
Expression| for passing it to MPL's own algorithm or metafunction: any library
component that is documented to accept a lambda expression makes the placeholders
implicitly available for the user code |-- end note|
Parameters
----------
None.
Expression semantics
--------------------
For any integral constant ``n`` in the range [1, |BOOST_MPL_LIMIT_METAFUNCTION_ARITY|\] and
arbitrary types |a1...an|:
.. parsed-literal::
typedef apply_wrap\ *n*\<_\ *n*\,a1,\ |...|\a\ *n*\ >::type x;
:Return type:
A type.
:Semantics:
Equivalent to
.. parsed-literal::
typedef apply_wrap\ *n*\< arg<\ *n*\ >,a1,\ |...|\a\ *n* >::type x;
Example
-------
.. parsed-literal::
typedef apply_wrap\ ``5``\< _1,bool,char,short,int,long >::type t1;
typedef apply_wrap\ ``5``\< _3,bool,char,short,int,long >::type t3;
BOOST_MPL_ASSERT(( is_same< t1, bool > ));
BOOST_MPL_ASSERT(( is_same< t3, short > ));
See also
--------
|Composition and Argument Binding|, |arg|, |lambda|, |bind|, |apply|, |apply_wrap|
@@ -1,77 +0,0 @@
.. Iterators/Concepts//Random Access Iterator |30
Random Access Iterator
======================
Description
-----------
A |Random Access Iterator| is a |Bidirectional Iterator| that provides
constant-time guarantees on moving the iterator an arbitrary number of positions
forward or backward and for measuring the distance to another iterator in the
same sequence.
Refinement of
-------------
|Bidirectional Iterator|
Expression requirements
-----------------------
In addition to the requirements defined in |Bidirectional Iterator|,
the following requirements must be met.
+---------------------------+-------------------------------------------+---------------------------+
| Expression | Type | Complexity |
+===========================+===========================================+===========================+
| ``next<i>::type`` | |Random Access Iterator| | Amortized constant time |
+---------------------------+-------------------------------------------+---------------------------+
| ``prior<i>::type`` | |Random Access Iterator| | Amortized constant time |
+---------------------------+-------------------------------------------+---------------------------+
| ``i::category`` | |Integral Constant|, convertible | Constant time |
| | to ``random_access_iterator_tag`` | |
+---------------------------+-------------------------------------------+---------------------------+
| ``advance<i,n>::type`` | |Random Access Iterator| | Amortized constant time |
+---------------------------+-------------------------------------------+---------------------------+
| ``distance<i,j>::type`` | |Integral Constant| | Amortized constant time |
+---------------------------+-------------------------------------------+---------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef advance<i,n>::type j;
:Semantics:
See ``advance`` specification
.. ..........................................................................
.. parsed-literal::
typedef distance<i,j>::type n;
:Semantics:
See ``distance`` specification
Invariants
----------
For any random access iterators ``i`` and ``j`` the following invariants always
hold:
* If ``advance<i,n>::type`` is well-defined, then
``advance< advance<i,n>::type, negate<n>::type >::type`` is a null operation.
See also
--------
|Iterators|, |Bidirectional Iterator|, |Random Access Sequence|, |advance|, |distance|
@@ -1,61 +0,0 @@
.. Sequences/Concepts//Random Access Sequence |30
Random Access Sequence
======================
Description
-----------
A |Random Access Sequence| is a |Bidirectional Sequence| whose iterators model
|Random Access Iterator|. A random access sequence guarantees amortized constant
time access to an arbitrary sequence element.
Refinement of
-------------
|Bidirectional Sequence|
Expression requirements
-----------------------
In addition to the requirements defined in |Bidirectional Sequence|,
for any |Random Access Sequence| ``s`` the following must be met:
+---------------------------+-----------------------------------+---------------------------+
| Expression | Type | Complexity |
+===========================+===================================+===========================+
| ``begin<s>::type`` | |Random Access Iterator| | Amortized constant time |
+---------------------------+-----------------------------------+---------------------------+
| ``end<s>::type`` | |Random Access Iterator| | Amortized constant time |
+---------------------------+-----------------------------------+---------------------------+
| ``at<s,n>::type`` | Any type | Amortized constant time |
+---------------------------+-----------------------------------+---------------------------+
Expression semantics
--------------------
Semantics of an expression is defined only where it differs from, or is not
defined in |Bidirectional Sequence|.
+---------------------------+-----------------------------------------------------------------------+
| Expression | Semantics |
+===========================+=======================================================================+
| ``at<s,n>::type`` | The ``n``\ th element from the beginning of the sequence; see |at|. |
+---------------------------+-----------------------------------------------------------------------+
Models
------
* |vector|
* |range_c|
See also
--------
|Sequences|, |Bidirectional Sequence|, |Extensible Sequence|, |Random Access Iterator|,
|begin| / |end|, |at|
-163
View File
@@ -1,163 +0,0 @@
.. Algorithms/Concepts//Reversible Algorithm
Reversible Algorithm
====================
Description
-----------
A |Reversible Algorithm| is a member of a pair of
transformation algorithms that iterate over their input sequence(s)
in opposite directions. For each reversible
algorithm ``x`` there exists a *counterpart* algorithm ``reverse_x``,
that exhibits the exact semantics of ``x`` except that the elements
of its input sequence argument(s) are processed in the reverse
order.
Expression requirements
-----------------------
.. |s1...sn| replace:: *s*\ :sub:`1`,\ *s*\ :sub:`2`,...\ *s*\ :sub:`n`
.. |s1...sn>::type| replace:: |s1...sn|, ...\ ``>::type``
.. |s1...sn,in>::type| replace:: |s1...sn|, ... ``in>::type``
|In the following table...| ``x`` is a placeholder token for the actual
|Reversible Algorithm|'s name, |s1...sn| are
|Forward Sequence|\ s, and ``in`` is an |Inserter|.
+---------------------------------------+-----------------------+-------------------+
| Expression | Type | Complexity |
+=======================================+=======================+===================+
|``x<``\ |s1...sn>::type| | |Forward Sequence| | Unspecified. |
+---------------------------------------+-----------------------+-------------------+
|``x<``\ |s1...sn,in>::type| | Any type | Unspecified. |
+---------------------------------------+-----------------------+-------------------+
|``reverse_x<``\ |s1...sn>::type| | |Forward Sequence| | Unspecified. |
+---------------------------------------+-----------------------+-------------------+
|``reverse_x<``\ |s1...sn,in>::type| | Any type | Unspecified. |
+---------------------------------------+-----------------------+-------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef x<\ *s*\ :sub:`1`,\ *s*\ :sub:`2`,...\ *s*\ :sub:`n`,...>::type t;
:Precondition:
*s*\ :sub:`1` is an |Extensible Sequence|.
:Semantics:
``t`` is equivalent to
.. parsed-literal::
x<
*s*\ :sub:`1`,\ *s*\ :sub:`2`,...\ *s*\ :sub:`n`,...
, back_inserter< clear<\ *s*\ :sub:`1`>::type >
>::type
if ``has_push_back<``\ *s*\ :sub:`1`\ ``>::value == true`` and
.. parsed-literal::
reverse_x<
*s*\ :sub:`1`,\ *s*\ :sub:`2`,...\ *s*\ :sub:`n`,...
, front_inserter< clear<\ *s*\ :sub:`1`>::type >
>::type
otherwise.
.. ..........................................................................
.. parsed-literal::
typedef x<\ *s*\ :sub:`1`,\ *s*\ :sub:`2`,...\ *s*\ :sub:`n`,...\ in>::type t;
:Semantics:
``t`` is the result of an ``x`` invocation with arguments
*s*\ :sub:`1`,\ *s*\ :sub:`2`,... \ *s*\ :sub:`n`,...\ ``in``.
.. ..........................................................................
.. parsed-literal::
typedef reverse_x<\ *s*\ :sub:`1`,\ *s*\ :sub:`2`,... \ *s*\ :sub:`n`,... >::type t;
:Precondition:
*s*\ :sub:`1` is an |Extensible Sequence|.
:Semantics:
``t`` is equivalent to
.. parsed-literal::
x<
*s*\ :sub:`1`,\ *s*\ :sub:`2`,...\ *s*\ :sub:`n`,...
, front_inserter< clear<\ *s*\ :sub:`1`>::type >
>::type
if ``has_push_front<``\ *s*\ :sub:`1`\ ``>::value == true`` and
.. parsed-literal::
reverse_x<
*s*\ :sub:`1`,\ *s*\ :sub:`2`,...\ *s*\ :sub:`n`,...
, back_inserter< clear<\ *s*\ :sub:`1`>::type >
>::type
otherwise.
.. ..........................................................................
.. parsed-literal::
typedef reverse_x<\ *s*\ :sub:`1`,\ *s*\ :sub:`2`,...\ *s*\ :sub:`n`,... in>::type t;
:Semantics:
``t`` is the result of a ``reverse_x`` invocation with arguments
*s*\ :sub:`1`,\ *s*\ :sub:`2`,...\ *s*\ :sub:`n`,...\ ``in``.
Example
-------
.. parsed-literal::
typedef transform<
range_c<int,0,10>
, plus<_1,int_<7> >
, back_inserter< vector0<> >
>::type r1;
typedef transform< r1, minus<_1,int_<2> > >::type r2;
typedef reverse_transform<
r2
, minus<_1,5>
, front_inserter< vector0<> >
>::type r3;
BOOST_MPL_ASSERT(( equal<r1, range_c<int,7,17> > ));
BOOST_MPL_ASSERT(( equal<r2, range_c<int,5,15> > ));
BOOST_MPL_ASSERT(( equal<r3, range_c<int,0,10> > ));
Models
------
* |transform|
* |remove|
* |replace|
See also
--------
|Transformation Algorithms|, |Inserter|
-6
View File
@@ -1,6 +0,0 @@
The MPL provides a large number of predefined general-purpose sequence
classes covering most of the typical metaprogramming needs out-of-box.
.. For all library-supplied sequences a publicly-derived class with no additional
members is equivalent except for type identity.
-28
View File
@@ -1,28 +0,0 @@
The taxonomy of sequence concepts in MPL parallels the taxonomy of the MPL
|iterators|, with two additional classification dimensions:
`extensibility` and `associativeness`.
.. The latter two are orthogonal to
sequence traversal characteristics, but not to each other, meaning that
a sequence can be characterized as both `Bidirectional`__
and `Back Extensible`__, or `Bidirectional`__ and
`Extensible Associative`__, but not as `Bidirectional`__,
`Back Extensible`__ *and* `Extensible Associative`__.
__ `Bidirectional Sequence`_
__ `Back Extensible Sequence`_
__ `Bidirectional Sequence`_
__ `Extensible Associative Sequence`_
__ `Bidirectional Sequence`_
__ `Back Extensible Sequence`_
__ `Extensible Associative Sequence`_
Two utility concepts, |Variadic Sequence| and |Integral Sequence Wrapper|,
are not applicable in generic contexts, but are used to group together
the common parts of different sequence classes' specifications.
.. |sequence concepts| replace:: `sequence concepts`__
__ `label-Sequences-Concepts`_
-17
View File
@@ -1,17 +0,0 @@
The metafunctions that form the essential interface of sequence `classes`__
documented in the corresponding |sequence concepts| are known as
*intrinsic sequence operations*. They differ from generic
|sequence algorithms| in that, in general, they need to be implemented
from scratch for each new sequence class [#intrinsic]_.
__ `label-Sequences-Classes`_
It's worth noting that STL counterparts of these metafunctions are
usually implemented as member functions.
.. [#intrinsic] In practice, many of intrinsic metafunctions offer a
default implementation that will work in majority of cases, given
that you've implemented the core functionality they rely on (such
as |begin| / |end|).
-11
View File
@@ -1,11 +0,0 @@
A *view* is a sequence adaptor delivering an altered presentation of
one or more underlying sequences. Views are lazy, meaning that their
elements are only computed on demand. Similarly to the short-circuit
|logical operations| and |eval_if|, views make it possible to avoid
premature errors and inefficiencies from computations whose results
will never be used. When approached with views in mind, many
algorithmic problems can be solved in a simpler, more conceptually
precise, more expressive way.
.. |Views| replace:: `Views`_
-18
View File
@@ -1,18 +0,0 @@
Compile-time sequences of types are one of the basic concepts of C++
template metaprogramming. Differences in types of objects being
manipulated is the most common point of variability of similar, but
not identical designs, and these are a direct target for
metaprogramming. Templates were originally designed to address this
exact problem. However, without predefined mechanisms for
representing and manipulating *sequences* of types as opposed to
standalone template parameters, high-level template metaprogramming
is severely limited in its capabitilies.
The MPL recognizes the importance of type sequences as a fundamental
building block of many higher-level metaprogramming designs by
providing us with a conceptual framework for formal reasoning
and understanding of sequence properties, guarantees and
characteristics, as well as a first-class implementation of that
framework |--| a wealth of tools for concise, convenient,
conceptually precise and efficient sequence manipulation.
@@ -1,163 +0,0 @@
.. Metafunctions/Concepts//Tag Dispatched Metafunction |50
Tag Dispatched Metafunction
===========================
Summary
-------
A |Tag Dispatched Metafunction| is a |Metafunction| that employs a
*tag dispatching* technique in its implementation to build an
infrastructure for easy overriding/extenstion of the metafunction's
behavior.
Notation
--------
.. _`tag-metafunction`:
+---------------------------+-----------------------------------------------------------+
| Symbol | Legend |
+===========================+===========================================================+
| |``name``| | A placeholder token for the specific metafunction's name. |
+---------------------------+-----------------------------------------------------------+
| |``tag-metafunction``| | A placeholder token for the tag metafunction's name. |
+---------------------------+-----------------------------------------------------------+
| |``tag``| | A placeholder token for one of possible tag types |
| | returned by the tag metafunction. |
+---------------------------+-----------------------------------------------------------+
.. |``name``| replace:: *name*
.. |``tag-metafunction``| replace:: *tag-metafunction*
.. |``tag``| replace:: *tag*
Synopsis
--------
.. parsed-literal::
template< typename Tag > struct *name*\_impl;
template<
typename X
*[, ...]*
>
struct *name*
: *name*\_impl< typename *tag-metafunction*\<X>::type >
::template apply<X *[, ...]*>
{
};
template< typename Tag > struct *name*\_impl
{
template< typename X *[, ...]* > struct apply
{
// *default implementation*
};
};
template<> struct *name*\_impl<*tag*>
{
template< typename X *[, ...]* > struct apply
{
// *tag-specific implementation*
};
};
Description
-----------
The usual mechanism for overriding a metafunction's behavior is class
template specialization |--| given a library-defined metafunction ``f``,
it's possible to write a specialization of ``f`` for a specific type
``user_type`` that would have the required semantics [#spec]_.
While this mechanism is always available, it's not always the most
convenient one, especially if it is desirable to specialize a
metafunction's behavior for a *family* of related types. A typical
example of it is numbered forms of sequence classes in MPL itself
(``list0``, ..., ``list50``, et al.), and sequence classes in general.
A |Tag Dispatched Metafunction| is a concept name for an instance of
the metafunction implementation infrastructure being employed by the
library to make it easier for users and implementors to override the
behavior of library's metafunctions operating on families of specific
types.
The infrastructure is built on a variation of the technique commonly
known as *tag dispatching* (hence the concept name),
and involves three entities: a metafunction itself, an associated
tag-producing |tag-metafunction|, and the metafunction's
implementation, in the form of a |Metafunction Class| template
parametrized by a ``Tag`` type parameter. The metafunction redirects
to its implementation class template by invoking its specialization
on a tag type produced by the tag metafunction with the original
metafunction's parameters.
.. [#spec] Usually such user-defined specialization is still required
to preserve the ``f``'s original invariants and complexity requirements.
Example
-------
.. parsed-literal::
#include <boost/mpl/size.hpp>
namespace user {
struct bitset_tag;
struct bitset0
{
typedef bitset_tag tag;
// ...
};
template< typename B0 > struct bitset1
{
typedef bitset_tag tag;
// ...
};
template< typename B0, *...,* typename B\ *n* > struct bitset\ *n*
{
typedef bitset_tag tag;
// ...
};
} // namespace user
namespace boost { namespace mpl {
template<> struct size_impl<user::bitset_tag>
{
template< typename Bitset > struct apply
{
typedef typename Bitset::size type;
};
};
}}
Models
-------
* |sequence_tag|
See also
--------
|Metafunction|, |Metafunction Class|, |Numeric Metafunction|
.. |tag-metafunction| replace:: `tag metafunction`__
__ `tag-metafunction`_
.. |tag dispatched| replace:: `tag dispatched`__
__ `Tag Dispatched Metafunction`_
-60
View File
@@ -1,60 +0,0 @@
.. Metafunctions/Concepts//Trivial Metafunction |70
Trivial Metafunction
====================
Description
-----------
A |Trivial Metafunction| accepts a single argument of a class type ``x`` and
returns the ``x``\ 's nested type member ``x::name``, where ``name`` is
a placeholder token for the actual member's name accessed by a specific
metafunction's instance. By convention, all `trivial metafunctions`__ in MPL
are named after the members they provide assess to. For instance, a |Trivial
Metafunction| named ``first`` reaches for the ``x``\ 's nested member
``::first``.
__ `Trivial Metafunctions Summary`_
Expression requirements
-----------------------
|In the following table...| ``name`` is placeholder token for the names of
the |Trivial Metafunction| itself and the accessed member, and ``x`` is
a class type such that ``x::name`` is a valid *type-name*.
+---------------------------+-------------------+---------------------------+
| Expression | Type | Complexity |
+===========================+===================+===========================+
| ``name<x>::type`` | Any type | Constant time. |
+---------------------------+-------------------+---------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef name<x>::type r;
:Precondition:
``x::name`` is a valid *type-name*.
:Semantics:
``is_same<r,x::name>::value == true``.
Models
------
* |first|
* |second|
* |base|
See also
--------
|Metafunctions|, |Trivial Metafunctions|, |identity|
-118
View File
@@ -1,118 +0,0 @@
.. Sequences/Concepts//Variadic Sequence |100
Variadic Sequence
=================
Description
-----------
A |Variadic Sequence| is a member of a family of sequence classes with both
*variadic* and *numbered* forms. If ``seq`` is a generic name for some
|Variadic Sequence|, its *variadic form* allows us to specify a sequence of
*n* elements |t1...tn|, for any *n* from 0 up to a
`preprocessor-configurable limit`__ ``BOOST_MPL_LIMIT_``\ *seq*\ ``_SIZE``,
using the following notation:
__ `Configuration`_
.. line-block::
``seq<``\ |t1...tn|\ ``>``
By contrast, each *numbered* sequence form accepts the exact number of elements
that is encoded in the name of the corresponding class template:
.. line-block::
``seq``\ *n*\ ``<``\ |t1...tn|\ ``>``
For numbered forms, there is no predefined top limit for *n*, aside from compiler
limitations on the number of template parameters.
.. The variadic form of sequence ``seq`` is defined in
``<boost/mpl/``\ *seq*\ ``.hpp>`` header.
The numbered forms are defined in batches of 10.
Expression requirements
-----------------------
|In the following table...| ``seq`` is a placeholder token for the actual
|Variadic Sequence| name.
.. |seq<t1...tn>| replace:: ``seq<``\ |t1...tn|\ ``>``
.. |seq<t1...tn>::type| replace:: ``seq<``\ |t1...tn|\ ``>::type``
.. |seqn<t1...tn>| replace:: ``seq``\ *n*\ ``<``\ |t1...tn|\ ``>``
.. |seqn<t1...tn>::type| replace:: ``seq``\ *n*\ ``<``\ |t1...tn|\ ``>::type``
+---------------------------+-----------------------+---------------------------+
| Expression | Type | Complexity |
+===========================+=======================+===========================+
| |seq<t1...tn>| | |Forward Sequence| | Amortized constant time |
+---------------------------+-----------------------+---------------------------+
| |seq<t1...tn>::type| | |Forward Sequence| | Amortized constant time |
+---------------------------+-----------------------+---------------------------+
| |seqn<t1...tn>| | |Forward Sequence| | Amortized constant time |
+---------------------------+-----------------------+---------------------------+
| |seqn<t1...tn>::type| | |Forward Sequence| | Amortized constant time |
+---------------------------+-----------------------+---------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef seq<|t1...tn|> s;
typedef seq\ *n*\ <|t1...tn|> s;
:Semantics:
``s`` is a sequence of elements |t1...tn|.
:Postcondition:
``size<s>::value == n``.
.. FIXME .. parsed-literal::
BOOST_MPL_ASSERT((|is_same|\< at_c<v,0>::type,\ |t1| >));
BOOST_MPL_ASSERT((|is_same|\< at_c<v,1>::type,\ |t2| >));
...
BOOST_MPL_ASSERT((|is_same|\< at_c<v,\ *n*>::type,\ |tn| >));
.. ..........................................................................
.. parsed-literal::
typedef seq<|t1...tn|>::type s;
typedef seq\ *n*\ <|t1...tn|>::type s;
:Semantics:
``s`` is identical to ``seq``\ *n*\ ``<``\ |t1...tn| ``>``.
:Postcondition:
``size<s>::value == n``.
Models
------
* |vector|
* |list|
* |map|
See also
--------
|Sequences|, |Configuration|, |Integral Sequence Wrapper|
.. |variadic| replace:: `variadic`__
__ `Variadic Sequence`_
.. |variadic forms| replace:: `variadic forms`__
__ `Variadic Sequence`_
.. |numbered forms| replace:: `numbered forms`__
__ `Variadic Sequence`_
-102
View File
@@ -1,102 +0,0 @@
.. Algorithms/Iteration Algorithms//accumulate |10
accumulate
==========
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
, typename State
, typename ForwardOp
>
struct accumulate
{
typedef |unspecified| type;
};
Description
-----------
Returns the result of the successive application of binary ``ForwardOp`` to the
result of the previous ``ForwardOp`` invocation (``State`` if it's the first call)
and every element of the sequence in the range |begin/end<Sequence>| in order.
|Note:| ``accumulate`` is a synonym for |fold| |-- end note|
Header
------
.. parsed-literal::
#include <boost/mpl/accumulate.hpp>
Parameters
----------
+---------------+-------------------------------+---------------------------------------------------+
| Parameter | Requirement | Description |
+===============+===============================+===================================================+
| ``Sequence`` | |Forward Sequence| | A sequence to iterate. |
+---------------+-------------------------------+---------------------------------------------------+
| ``State`` | Any type | The initial state for the first ``ForwardOp`` |
| | | application. |
+---------------+-------------------------------+---------------------------------------------------+
| ``ForwardOp`` | Binary |Lambda Expression| | The operation to be executed on forward |
| | | traversal. |
+---------------+-------------------------------+---------------------------------------------------+
Expression semantics
--------------------
For any |Forward Sequence| ``s``, binary |Lambda Expression| ``op``, and arbitrary type ``state``:
.. parsed-literal::
typedef accumulate<s,state,op>::type t;
:Return type:
A type.
:Semantics:
Equivalent to
.. parsed-literal::
typedef fold<s,state,op>::type t;
Complexity
----------
Linear. Exactly ``size<s>::value`` applications of ``op``.
Example
-------
.. parsed-literal::
typedef vector<long,float,short,double,float,long,long double> types;
typedef accumulate<
types
, int_<0>
, if_< is_float<_2>,next<_1>,_1 >
>::type number_of_floats;
BOOST_MPL_ASSERT_RELATION( number_of_floats::value, ==, 4 );
See also
--------
|Algorithms|, |fold|, |reverse_fold|, |iter_fold|, |reverse_iter_fold|, |copy|, |copy_if|
-129
View File
@@ -1,129 +0,0 @@
.. Iterators/Iterator Metafunctions//advance |10
advance
=======
Synopsis
--------
.. parsed-literal::
template<
typename Iterator
, typename N
>
struct advance
{
typedef |unspecified| type;
};
Description
-----------
Moves ``Iterator`` by the distance ``N``. For |bidirectional| and
|random access| iterators, the distance may be negative.
Header
------
.. parsed-literal::
#include <boost/mpl/advance.hpp>
Parameters
----------
+---------------+---------------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===================================+
| ``Iterator`` | |Forward Iterator| | An iterator to advance. |
+---------------+---------------------------+-----------------------------------+
| ``N`` | |Integral Constant| | A distance. |
+---------------+---------------------------+-----------------------------------+
Model Of
--------
|Tag Dispatched Metafunction|
Expression semantics
--------------------
For a |Forward Iterator| ``iter`` and arbitrary |Integral Constant| ``n``:
.. parsed-literal::
typedef advance<iter,n>::type j;
:Return type:
|Forward Iterator|.
:Precondition:
If ``Iterator`` is a |Forward Iterator|, ``n::value`` must be nonnegative.
:Semantics:
Equivalent to:
.. parsed-literal::
typedef iter i0;
typedef next<i0>::type i1;
|...|
typedef next<i\ *n-1*\ >::type j;
if ``n::value > 0``, and
.. parsed-literal::
typedef iter i0;
typedef prior<i0>::type i1;
|...|
typedef prior<i\ *n-1*\ >::type j;
otherwise.
:Postcondition:
``j`` is dereferenceable or past-the-end;
``distance<iter,j>::value == n::value`` if ``n::value > 0``, and
``distance<j,iter>::value == n::value`` otherwise.
Complexity
----------
Amortized constant time if ``iter`` is a model of
|Random Access Iterator|, otherwise linear time.
Example
-------
.. parsed-literal::
typedef range_c<int,0,10> numbers;
typedef begin<numbers>::type first;
typedef end<numbers>::type last;
typedef advance<first,int_<10> >::type i1;
typedef advance<last,int_<-10> >::type i2;
BOOST_MPL_ASSERT(( boost::is_same<i1,last> ));
BOOST_MPL_ASSERT(( boost::is_same<i2,first> ));
See also
--------
|Iterators|, |Tag Dispatched Metafunction|, |distance|, |next|
.. |bidirectional| replace:: `bidirectional`_
.. _bidirectional: `Bidirectional Iterator`_
.. |random access| replace:: `random access`_
.. _random access: `Random Access Iterator`_
-87
View File
@@ -1,87 +0,0 @@
.. Metafunctions/Miscellaneous//always |20
always
======
Synopsis
--------
.. parsed-literal::
template<
typename X
>
struct always
{
// |unspecified|
// |...|
};
Description
-----------
``always<X>`` specialization is a variadic |Metafunction Class| always returning the
same type, ``X``, regardless of the number and types of passed arguments.
Header
------
.. parsed-literal::
#include <boost/mpl/always.hpp>
Model of
--------
|Metafunction Class|
Parameters
----------
+---------------+-------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===============+===================+===================================+
| ``X`` | Any type | A type to be returned. |
+---------------+-------------------+-----------------------------------+
Expression semantics
--------------------
For an arbitrary type ``x``:
.. parsed-literal::
typedef always<x> f;
:Return type:
|Metafunction Class|.
:Semantics:
Equivalent to
.. parsed-literal::
struct f : bind< identity<_1>, x > {};
Example
-------
.. parsed-literal::
typedef always<true\_> always_true;
BOOST_MPL_ASSERT(( apply< always_true,false\_> ));
BOOST_MPL_ASSERT(( apply< always_true,false\_,false\_ > ));
BOOST_MPL_ASSERT(( apply< always_true,false\_,false\_,false\_ > ));
See also
--------
|Metafunctions|, |Metafunction Class|, |identity|, |bind|, |apply|
-104
View File
@@ -1,104 +0,0 @@
.. Metafunctions/Logical Operations//and_ |10
and\_
=====
Synopsis
--------
.. parsed-literal::
template<
typename F1
, typename F2
|...|
, typename F\ *n* = |unspecified|
>
struct and\_
{
typedef |unspecified| type;
};
Description
-----------
Returns the result of short-circuit *logical and* (``&&``) operation on its arguments.
Header
------
.. parsed-literal::
#include <boost/mpl/and.hpp>
#include <boost/mpl/logical.hpp>
Parameters
----------
+---------------+---------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===============================================+
| |F1...Fn| | Nullary |Metafunction| | Operation's arguments. |
+---------------+---------------------------+-----------------------------------------------+
Expression semantics
--------------------
For arbitrary nullary |Metafunction|\ s |f1...fn|:
.. parsed-literal::
typedef and_<f1,f2,\ |...|\ ,f\ *n*\>::type r;
:Return type:
|Integral Constant|.
:Semantics:
``r`` is ``false_`` if either of ``f1::type::value``, ``f2::type::value``,...
``fn::type::value`` expressions evaluates to ``false``, and ``true_`` otherwise;
guarantees left-to-right evaluation; the operands subsequent to the first
``f``\ *i* metafunction that evaluates to ``false`` are not evaluated.
.. ..........................................................................
.. parsed-literal::
typedef and_<f1,f2,\ |...|\ ,f\ *n*\> r;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
struct r : and_<f1,f2,\ |...|\ ,f\ *n*\>::type {};
Example
-------
.. parsed-literal::
struct unknown;
BOOST_MPL_ASSERT(( and_< true\_,true\_ > ));
BOOST_MPL_ASSERT_NOT(( and_< false\_,true\_ > ));
BOOST_MPL_ASSERT_NOT(( and_< true\_,false\_ > ));
BOOST_MPL_ASSERT_NOT(( and_< false\_,false\_ > ));
BOOST_MPL_ASSERT_NOT(( and_< false\_,unknown > )); // OK
BOOST_MPL_ASSERT_NOT(( and_< false\_,unknown,unknown > )); // OK too
See also
--------
|Metafunctions|, |Logical Operations|, |or_|, |not_|
-114
View File
@@ -1,114 +0,0 @@
.. Metafunctions/Invocation//apply |10
apply
=====
Synopsis
--------
.. parsed-literal::
template<
typename F
>
struct apply0
{
typedef |unspecified| type;
};
template<
typename F, typename A1
>
struct apply1
{
typedef |unspecified| type;
};
|...|
template<
typename F, typename A1,\ |...| typename An
>
struct apply\ *n*
{
typedef |unspecified| type;
};
template<
typename F
, typename A1 = |unspecified|
|...|
, typename An = |unspecified|
>
struct apply
{
typedef |unspecified| type;
};
Description
-----------
Invokes a |Metafunction Class| or a |Lambda Expression| ``F`` with arguments ``A1``,... ``An``.
Header
------
.. parsed-literal::
#include <boost/mpl/apply.hpp>
Parameters
----------
+---------------+-----------------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================================+===============================================+
| ``F`` | |Lambda Expression| | An expression to invoke. |
+---------------+-----------------------------------+-----------------------------------------------+
| |A1...An| | Any type | Invocation arguments. |
+---------------+-----------------------------------+-----------------------------------------------+
Expression semantics
--------------------
For any |Lambda Expression| ``f`` and arbitrary types ``a1``,... ``an``:
.. parsed-literal::
typedef apply\ *n*\<f,a1,\ |...|\ a\ *n*\>::type t;
typedef apply<f,a1,\ |...|\ a\ *n*\>::type t;
:Return type:
Any type.
:Semantics:
Equivalent to ``typedef apply_wrap``\ *n*\ ``< lambda<f>::type,a1,... an>::type t;``.
Example
-------
.. parsed-literal::
template< typename N1, typename N2 > struct int_plus
: int_<( N1::value + N2::value )>
{
};
typedef apply< int_plus<_1,_2>, int_<2>, int_<3> >::type r1;
typedef apply< quote\ ``2``\ <int_plus>, int_<2>, int_<3> >::type r2;
BOOST_MPL_ASSERT_RELATION( r1::value, ==, 5 );
BOOST_MPL_ASSERT_RELATION( r2::value, ==, 5 );
See also
--------
|Metafunctions|, |apply_wrap|, |lambda|, |quote|, |bind|
-129
View File
@@ -1,129 +0,0 @@
.. Metafunctions/Invocation//apply_wrap |20
apply_wrap
==========
Synopsis
--------
.. parsed-literal::
template<
typename F
>
struct apply_wrap0
{
typedef |unspecified| type;
};
template<
typename F, typename A1
>
struct apply_wrap1
{
typedef |unspecified| type;
};
|...|
template<
typename F, typename A1,\ |...| typename An
>
struct apply_wrap\ *n*
{
typedef |unspecified| type;
};
Description
-----------
Invokes a |Metafunction Class| ``F`` with arguments ``A1``,... ``An``.
In essence, ``apply_wrap`` forms are nothing more than syntactic wrappers around
``F::apply<A1,... An>::type`` / ``F::apply::type`` expressions (hence the name).
They provide a more concise notation and higher portability than their
underlaying constructs at the cost of an extra template instantiation.
Header
------
.. parsed-literal::
#include <boost/mpl/apply_wrap.hpp>
Parameters
----------
+---------------+-----------------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================================+===============================================+
| ``F`` | |Metafunction Class| | A metafunction class to invoke. |
+---------------+-----------------------------------+-----------------------------------------------+
| |A1...An| | Any type | Invocation arguments. |
+---------------+-----------------------------------+-----------------------------------------------+
Expression semantics
--------------------
For any |Metafunction Class| ``f`` and arbitrary types |a1...an|:
.. parsed-literal::
typedef apply_wrap\ *n*\ <f,a1,\ |...|\ an>::type t;
:Return type:
Any type.
:Semantics:
If ``n > 0``, equivalent to ``typedef f::apply<a1,... an>::type t;``,
otherwise equivalent to either ``typedef f::apply::type t;`` or
``typedef f::apply<>::type t;`` depending on whether ``f::apply`` is
a class or a class template.
Example
-------
.. parsed-literal::
struct f0
{
template< typename T = int > struct apply
{
typedef char type;
};
};
struct g0
{
struct apply { typedef char type; };
};
struct f2
{
template< typename T1, typename T2 > struct apply
{
typedef T2 type;
};
};
typedef apply_wrap\ ``0``\ < f0 >::type r1;
typedef apply_wrap\ ``0``\ < g0 >::type r2;
typedef apply_wrap\ ``2``\ < f2,int,char >::type r3;
BOOST_MPL_ASSERT(( is_same<r1,char> ));
BOOST_MPL_ASSERT(( is_same<r2,char> ));
BOOST_MPL_ASSERT(( is_same<r3,char> ));
See also
--------
|Metafunctions|, |Invocation|, |apply|, |lambda|, |quote|, |bind|, |protect|
-90
View File
@@ -1,90 +0,0 @@
.. Metafunctions/Composition and Argument Binding//arg |50
arg
===
Synopsis
--------
.. parsed-literal::
template< int n > struct arg;
template<> struct arg<1>
{
template< typename A1,\ |...| typename A\ *n* = |unspecified| >
struct apply
{
typedef A1 type;
};
};
|...|
template<> struct arg<\ *n*\>
{
template< typename A1,\ |...| typename A\ *n* >
struct apply
{
typedef A\ *n* type;
};
};
Description
-----------
``arg<n>`` specialization is a |Metafunction Class| that return the ``n``\ th of its arguments.
Header
------
.. parsed-literal::
#include <boost/mpl/arg.hpp>
Parameters
----------
+---------------+-----------------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================================+===============================================+
| ``n`` | An integral constant | A number of argument to return. |
+---------------+-----------------------------------+-----------------------------------------------+
Expression semantics
--------------------
For any integral constant ``n`` in the range [1, |BOOST_MPL_LIMIT_METAFUNCTION_ARITY|\] and
arbitrary types |a1...an|:
.. parsed-literal::
typedef apply_wrap\ *n*\< arg<\ *n*\ >,a1,\ |...|\a\ *n* >::type x;
:Return type:
A type.
:Semantics:
``x`` is identical to ``an``.
Example
-------
.. parsed-literal::
typedef apply_wrap\ ``5``\< arg<1>,bool,char,short,int,long >::type t1;
typedef apply_wrap\ ``5``\< arg<3>,bool,char,short,int,long >::type t3;
BOOST_MPL_ASSERT(( is_same< t1, bool > ));
BOOST_MPL_ASSERT(( is_same< t3, short > ));
See also
--------
|Composition and Argument Binding|, |Placeholders|, |lambda|, |bind|, |apply|, |apply_wrap|
-173
View File
@@ -1,173 +0,0 @@
.. Sequences/Intrinsic Metafunctions//at
at
==
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
, typename N
>
struct at
{
typedef |unspecified| type;
};
template<
typename AssocSeq
, typename Key
, typename Default = |unspecified|
>
struct at
{
typedef |unspecified| type;
};
Description
-----------
``at`` is an |overloaded name|:
* ``at<Sequence,N>`` returns the ``N``-th element from the beginning of the
|Forward Sequence| ``Sequence``.
* ``at<AssocSeq,Key,Default>`` returns the first element associated with ``Key``
in the |Associative Sequence| ``AssocSeq``, or ``Default`` if no such element
exists.
Header
------
.. parsed-literal::
#include <boost/mpl/at.hpp>
Model of
--------
|Tag Dispatched Metafunction|
Parameters
----------
+---------------+---------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===============================================+
| ``Sequence`` | |Forward Sequence| | A sequence to be examined. |
+---------------+---------------------------+-----------------------------------------------+
| ``AssocSeq`` | |Associative Sequence| | A sequence to be examined. |
+---------------+---------------------------+-----------------------------------------------+
| ``N`` | |Integral Constant| | An offset from the beginning of the sequence |
| | | specifying the element to be retrieved. |
+---------------+---------------------------+-----------------------------------------------+
| ``Key`` | Any type | A key for the element to be retrieved. |
+---------------+---------------------------+-----------------------------------------------+
| ``Default`` | Any type | A default value to return if the element is |
| | | not found. |
+---------------+---------------------------+-----------------------------------------------+
Expression semantics
--------------------
.. compound::
:class: expression-semantics
For any |Forward Sequence| ``s``, and |Integral Constant| ``n``:
.. parsed-literal::
typedef at<s,n>::type t;
:Return type:
A type.
:Precondition:
``0 <= n::value < size<s>::value``.
:Semantics:
Equivalent to
.. parsed-literal::
typedef deref< advance< begin<s>::type,n >::type >::type t;
.. compound::
:class: expression-semantics
For any |Associative Sequence| ``s``, and arbitrary types ``key`` and ``x``:
.. parsed-literal::
typedef at<s,key,x>::type t;
:Return type:
A type.
:Semantics:
If ``has_key<s,key>::value == true``, ``t`` is the value type associated with ``key``;
otherwise ``t`` is identical to ``x``.
.. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. parsed-literal::
typedef at<s,key>::type t;
:Return type:
A type.
:Semantics:
Equivalent to
.. parsed-literal::
typedef at<s,key,void\_>::type t;
Complexity
----------
+-------------------------------+-----------------------------------+
| Sequence archetype | Complexity |
+===============================+===================================+
| |Forward Sequence| | Linear. |
+-------------------------------+-----------------------------------+
| |Random Access Sequence| | Amortized constant time. |
+-------------------------------+-----------------------------------+
| |Associative Sequence| | Amortized constant time. |
+-------------------------------+-----------------------------------+
Example
-------
.. parsed-literal::
typedef range_c<long,10,50> range;
BOOST_MPL_ASSERT_RELATION( (at< range, int_<0> >::value), ==, 10 );
BOOST_MPL_ASSERT_RELATION( (at< range, int_<10> >::value), ==, 20 );
BOOST_MPL_ASSERT_RELATION( (at< range, int_<40> >::value), ==, 50 );
.. parsed-literal::
typedef set< int const,long*,double > s;
BOOST_MPL_ASSERT(( is_same< at<s,char>::type, void\_ > ));
BOOST_MPL_ASSERT(( is_same< at<s,int>::type, int > ));
See also
--------
|Forward Sequence|, |Random Access Sequence|, |Associative Sequence|, |at_c|, |front|, |back|
-100
View File
@@ -1,100 +0,0 @@
.. Sequences/Intrinsic Metafunctions//at_c
at_c
====
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
, long n
>
struct at_c
{
typedef |unspecified| type;
};
Description
-----------
Returns a type identical to the ``n``\ th element from the beginning of
the sequence. ``at_c<Sequence,n>::type`` is a shorcut notation for
``at< Sequence, long_<n> >::type``.
Header
------
.. parsed-literal::
#include <boost/mpl/at.hpp>
Parameters
----------
+---------------+-----------------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================================+===============================================+
| ``Sequence`` | |Forward Sequence| | A sequence to be examined. |
+---------------+-----------------------------------+-----------------------------------------------+
| ``n`` | A compile-time integral constant | An offset from the beginning of the sequence |
| | | specifying the element to be retrieved. |
+---------------+-----------------------------------+-----------------------------------------------+
Expression semantics
--------------------
.. parsed-literal::
typedef at_c<Sequence,n>::type t;
:Return type:
A type
:Precondition:
``0 <= n < size<Sequence>::value``
:Semantics:
Equivalent to
.. parsed-literal::
typedef at< Sequence, long_<n> >::type t;
Complexity
----------
+-------------------------------+-----------------------------------+
| Sequence archetype | Complexity |
+===============================+===================================+
| |Forward Sequence| | Linear. |
+-------------------------------+-----------------------------------+
| |Random Access Sequence| | Amortized constant time. |
+-------------------------------+-----------------------------------+
Example
-------
.. parsed-literal::
typedef range_c<long,10,50> range;
BOOST_MPL_ASSERT_RELATION( (at_c< range,0 >::type::value), ==, 10 );
BOOST_MPL_ASSERT_RELATION( (at_c< range,10 >::type::value), ==, 20 );
BOOST_MPL_ASSERT_RELATION( (at_c< range,40 >::type::value), ==, 50 );
See also
--------
|Forward Sequence|, |Random Access Sequence|, |at|, |front|, |back|
-99
View File
@@ -1,99 +0,0 @@
.. Sequences/Intrinsic Metafunctions//back
back
====
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
>
struct back
{
typedef |unspecified| type;
};
Description
-----------
Returns the last element in the sequence.
Header
------
.. parsed-literal::
#include <boost/mpl/back.hpp>
Model of
--------
|Tag Dispatched Metafunction|
Parameters
----------
+---------------+---------------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===================================+
| ``Sequence`` | |Bidirectional Sequence| | A sequence to be examined. |
+---------------+---------------------------+-----------------------------------+
Expression semantics
--------------------
For any |Bidirectional Sequence| ``s``:
.. parsed-literal::
typedef back<s>::type t;
:Return type:
A type.
:Precondition:
``empty<s>::value == false``.
:Semantics:
Equivalent to
.. parsed-literal::
typedef deref< prior< end<s>::type >::type >::type t;
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef range_c<int,0,1> range1;
typedef range_c<int,0,10> range2;
typedef range_c<int,-10,0> range3;
BOOST_MPL_ASSERT_RELATION( back<range1>::value, ==, 0 );
BOOST_MPL_ASSERT_RELATION( back<range2>::value, ==, 9 );
BOOST_MPL_ASSERT_RELATION( back<range3>::value, ==, -1 );
See also
--------
|Bidirectional Sequence|, |front|, |push_back|, |end|, |deref|, |at|
-89
View File
@@ -1,89 +0,0 @@
.. Algorithms/Inserters//back_inserter
back_inserter
=============
Synopsis
--------
.. parsed-literal::
template<
typename Seq
>
struct back_inserter
{
// |unspecified|
// |...|
};
Description
-----------
Inserts elements at the end of the sequence.
Header
------
.. parsed-literal::
#include <boost/mpl/back_inserter.hpp>
Model of
--------
|Inserter|
Parameters
----------
+---------------+-------------------------------+---------------------------------------+
| Parameter | Requirement | Description |
+===============+===============================+=======================================+
| ``Seq`` | |Back Extensible Sequence| | A sequence to bind the inserter to. |
+---------------+-------------------------------+---------------------------------------+
Expression semantics
--------------------
|Semantics disclaimer...| |Inserter|.
For any |Back Extensible Sequence| ``s``:
+---------------------------+-------------------------------------------------------+
| Expression | Semantics |
+===========================+=======================================================+
| ``back_inserter<s>`` | An |Inserter| ``in``, equivalent to |
| | |
| | .. parsed-literal:: |
| | |
| | struct in : inserter<s,push_back<_1,_2> > {}; |
+---------------------------+-------------------------------------------------------+
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef copy<
range_c<int,5,10>
, back_inserter< vector_c<int,0,1,2,3,4> >
>::type range;
BOOST_MPL_ASSERT(( equal< range, range_c<int,0,10> > ));
See also
--------
|Algorithms|, |Inserter|, |Reversible Algorithm|, |inserter|, |front_inserter|, |push_back|
-98
View File
@@ -1,98 +0,0 @@
.. Sequences/Intrinsic Metafunctions//begin
begin
=====
Synopsis
--------
.. parsed-literal::
template<
typename X
>
struct begin
{
typedef |unspecified| type;
};
Description
-----------
Returns an iterator that points to the first element of the sequence. If
the argument is not a |Forward Sequence|, returns |void_|.
Header
------
.. parsed-literal::
#include <boost/mpl/begin_end.hpp>
Model of
--------
|Tag Dispatched Metafunction|
Parameters
----------
+---------------+-------------------+---------------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================+===================================================+
| ``X`` | Any type | A type whose begin iterator, if any, will be |
| | | returned. |
+---------------+-------------------+---------------------------------------------------+
Expression semantics
--------------------
For any arbitrary type ``x``:
.. parsed-literal::
typedef begin<x>::type first;
:Return type:
|Forward Iterator| or |void_|.
:Semantics:
If ``x`` is a |Forward Sequence|, ``first`` is an iterator pointing to the
first element of ``s``; otherwise ``first`` is |void_|.
:Postcondition:
If ``first`` is an iterator, it is either dereferenceable or past-the-end; it
is past-the-end if and only if ``size<x>::value == 0``.
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef vector< unsigned char,unsigned short,
unsigned int,unsigned long > unsigned_types;
typedef begin<unsigned_types>::type iter;
BOOST_MPL_ASSERT(( is_same< deref<iter>::type, unsigned char > ));
BOOST_MPL_ASSERT(( is_same< begin<int>::type, void\_ > ));
See also
--------
|Iterators|, |Forward Sequence|, |end|, |size|, |empty|
-204
View File
@@ -1,204 +0,0 @@
.. Metafunctions/Composition and Argument Binding//bind |30
bind
====
Synopsis
--------
.. parsed-literal::
template<
typename F
>
struct bind0
{
// |unspecified|
// |...|
};
template<
typename F, typename A1
>
struct bind1
{
// |unspecified|
// |...|
};
|...|
template<
typename F, typename A1,\ |...| typename An
>
struct bind\ *n*
{
// |unspecified|
// |...|
};
template<
typename F
, typename A1 = |unspecified|
|...|
, typename An = |unspecified|
>
struct bind
{
// |unspecified|
// |...|
};
Description
-----------
``bind`` is a higher-order primitive for |Metafunction Class| composition
and argument binding. In essence, it's a compile-time counterpart of
the similar run-time functionality provided by |Boost.Bind| and |Boost.Lambda|
libraries.
Header
------
.. parsed-literal::
#include <boost/mpl/bind.hpp>
Model of
--------
|Metafunction Class|
Parameters
----------
+---------------+-----------------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================================+===============================================+
| ``F`` | |Metafunction Class| | An metafunction class to perform binding on. |
+---------------+-----------------------------------+-----------------------------------------------+
| |A1...An| | Any type | Arguments to bind. |
+---------------+-----------------------------------+-----------------------------------------------+
Expression semantics
--------------------
For any |Metafunction Class| ``f`` and arbitrary types |a1...an|:
.. parsed-literal::
typedef bind<f,a1,...a\ *n*\ > g;
typedef bind\ *n*\ <f,a1,...a\ *n*\ > g;
:Return type:
|Metafunction Class|
.. _`bind semantics`:
:Semantics:
Equivalent to
.. parsed-literal::
struct g
{
template<
typename U1 = |unspecified|
|...|
, typename U\ *n* = |unspecified|
>
struct apply
: apply_wrap\ *n*\ <
typename h0<f,U1,\ |...|\ U\ *n*>::type
, typename h1<a1,U1,\ |...|\ U\ *n*>::type
|...|
, typename h\ *n*\ <a\ *n*\ ,U1,\ |...|\ U\ *n*>::type
>
{
};
};
where ``h``\ *k* is equivalent to
.. parsed-literal::
template< typename X, typename U1,\ |...| typename U\ *n* > struct h\ *k*
: apply_wrap\ *n*\ <X,U1,\ |...|\ U\ *n*>
{
};
if ``f`` or ``a``\ *k* is a |bind expression| or a |placeholder|, and
.. parsed-literal::
template< typename X, typename U1,\ |...| typename U\ *n* > struct h\ *k*
{
typedef X type;
};
otherwise. |Note:| Every ``n``\th appearance of the `unnamed placeholder`__
in the ``bind<f,a1,...an>`` specialization is replaced with the corresponding
numbered placeholder ``_``\ *n* |-- end note|
__ `Placeholders`_
Example
-------
.. parsed-literal::
struct f1
{
template< typename T1 > struct apply
{
typedef T1 type;
};
};
struct f5
{
template< typename T1, typename T2, typename T3, typename T4, typename T5 >
struct apply
{
typedef T5 type;
};
};
typedef apply_wrap\ ``1``\<
bind\ ``1``\<f1,_1>
, int
>::type r11;
typedef apply_wrap\ ``5``\<
bind\ ``1``\<f1,_5>
, void,void,void,void,int
>::type r12;
BOOST_MPL_ASSERT(( is_same<r11,int> ));
BOOST_MPL_ASSERT(( is_same<r12,int> ));
typedef apply_wrap\ ``5``\<
bind\ ``5``\<f5,_1,_2,_3,_4,_5>
, void,void,void,void,int
>::type r51;
typedef apply_wrap\ ``5``\<
bind\ ``5``\<f5,_5,_4,_3,_2,_1>
, int,void,void,void,void
>::type r52;
BOOST_MPL_ASSERT(( is_same<r51,int> ));
BOOST_MPL_ASSERT(( is_same<r52,int> ));
See also
--------
|Composition and Argument Binding|, |Invocation|, |Placeholders|, |lambda|, |quote|,
|protect|, |apply|, |apply_wrap|
-128
View File
@@ -1,128 +0,0 @@
.. Metafunctions/Bitwise Operations//bitand_
bitand\_
========
Synopsis
--------
.. parsed-literal::
template<
typename T1
, typename T2
, typename T3 = |unspecified|
|...|
, typename T\ *n* = |unspecified|
>
struct bitand\_
{
typedef |unspecified| type;
};
Description
-----------
Returns the result of *bitwise and* (``&``) operation of its arguments.
Header
------
.. parsed-literal::
#include <boost/mpl/bitand.hpp>
#include <boost/mpl/bitwise.hpp>
Model of
--------
|Numeric Metafunction|
Parameters
----------
+---------------+---------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===============================================+
| |T1...Tn| | |Integral Constant| | Operation's arguments. |
+---------------+---------------------------+-----------------------------------------------+
|Note:| |numeric metafunction note| |-- end note|
Expression semantics
--------------------
For any |Integral Constant|\ s |c1...cn|:
.. parsed-literal::
typedef bitand_<c1,\ |...|\ c\ *n*\>::type r;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
typedef integral_c<
typeof(c1::value & c2::value)
, ( c1::value & c2::value )
> c;
typedef bitand_<c,c3,\ |...|\c\ *n*\>::type r;
.. ..........................................................................
.. parsed-literal::
typedef bitand_<c1,\ |...|\ c\ *n*\> r;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
struct r : bitand_<c1,\ |...|\ c\ *n*\>::type {};
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef integral_c<unsigned,0> u0;
typedef integral_c<unsigned,1> u1;
typedef integral_c<unsigned,2> u2;
typedef integral_c<unsigned,8> u8;
typedef integral_c<unsigned,0xffffffff> uffffffff;
BOOST_MPL_ASSERT_RELATION( (bitand_<u0,u0>::value), ==, 0 );
BOOST_MPL_ASSERT_RELATION( (bitand_<u1,u0>::value), ==, 0 );
BOOST_MPL_ASSERT_RELATION( (bitand_<u0,u1>::value), ==, 0 );
BOOST_MPL_ASSERT_RELATION( (bitand_<u0,uffffffff>::value), ==, 0 );
BOOST_MPL_ASSERT_RELATION( (bitand_<u1,uffffffff>::value), ==, 1 );
BOOST_MPL_ASSERT_RELATION( (bitand_<u8,uffffffff>::value), ==, 8 );
See also
--------
|Bitwise Operations|, |Numeric Metafunction|, |numeric_cast|, |bitor_|, |bitxor_|, |shift_left|
-128
View File
@@ -1,128 +0,0 @@
.. Metafunctions/Bitwise Operations//bitor_
bitor\_
=======
Synopsis
--------
.. parsed-literal::
template<
typename T1
, typename T2
, typename T3 = |unspecified|
|...|
, typename T\ *n* = |unspecified|
>
struct bitor\_
{
typedef |unspecified| type;
};
Description
-----------
Returns the result of *bitwise or* (``|``) operation of its arguments.
Header
------
.. parsed-literal::
#include <boost/mpl/bitor.hpp>
#include <boost/mpl/bitwise.hpp>
Model of
--------
|Numeric Metafunction|
Parameters
----------
+---------------+---------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===============================================+
| |T1...Tn| | |Integral Constant| | Operation's arguments. |
+---------------+---------------------------+-----------------------------------------------+
|Note:| |numeric metafunction note| |-- end note|
Expression semantics
--------------------
For any |Integral Constant|\ s |c1...cn|:
.. parsed-literal::
typedef bitor_<c1,\ |...|\ c\ *n*\>::type r;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
typedef integral_c<
typeof(c1::value | c2::value)
, ( c1::value | c2::value )
> c;
typedef bitor_<c,c3,\ |...|\c\ *n*\>::type r;
.. ..........................................................................
.. parsed-literal::
typedef bitor_<c1,\ |...|\ c\ *n*\> r;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
struct r : bitor_<c1,\ |...|\ c\ *n*\>::type {};
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef integral_c<unsigned,0> u0;
typedef integral_c<unsigned,1> u1;
typedef integral_c<unsigned,2> u2;
typedef integral_c<unsigned,8> u8;
typedef integral_c<unsigned,0xffffffff> uffffffff;
BOOST_MPL_ASSERT_RELATION( (bitor_<u0,u0>::value), ==, 0 );
BOOST_MPL_ASSERT_RELATION( (bitor_<u1,u0>::value), ==, 1 );
BOOST_MPL_ASSERT_RELATION( (bitor_<u0,u1>::value), ==, 1 );
BOOST_MPL_ASSERT_RELATION( (bitor_<u0,uffffffff>::value), ==, 0xffffffff );
BOOST_MPL_ASSERT_RELATION( (bitor_<u1,uffffffff>::value), ==, 0xffffffff );
BOOST_MPL_ASSERT_RELATION( (bitor_<u8,uffffffff>::value), ==, 0xffffffff );
See also
--------
|Bitwise Operations|, |Numeric Metafunction|, |numeric_cast|, |bitand_|, |bitxor_|, |shift_left|
-129
View File
@@ -1,129 +0,0 @@
.. Metafunctions/Bitwise Operations//bitxor_
bitxor\_
========
Synopsis
--------
.. parsed-literal::
template<
typename T1
, typename T2
, typename T3 = |unspecified|
|...|
, typename T\ *n* = |unspecified|
>
struct bitxor\_
{
typedef |unspecified| type;
};
Description
-----------
Returns the result of *bitwise xor* (``^``) operation of its arguments.
Header
------
.. parsed-literal::
#include <boost/mpl/bitxor.hpp>
#include <boost/mpl/bitwise.hpp>
Model of
--------
|Numeric Metafunction|
Parameters
----------
+---------------+---------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===============================================+
| |T1...Tn| | |Integral Constant| | Operation's arguments. |
+---------------+---------------------------+-----------------------------------------------+
|Note:| |numeric metafunction note| |-- end note|
Expression semantics
--------------------
For any |Integral Constant|\ s |c1...cn|:
.. parsed-literal::
typedef bitxor_<c1,\ |...|\ c\ *n*\>::type r;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
typedef integral_c<
typeof(c1::value ^ c2::value)
, ( c1::value ^ c2::value )
> c;
typedef bitxor_<c,c3,\ |...|\c\ *n*\>::type r;
.. ..........................................................................
.. parsed-literal::
typedef bitxor_<c1,\ |...|\ c\ *n*\> r;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
struct r : bitxor_<c1,\ |...|\ c\ *n*\>::type {};
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef integral_c<unsigned,0> u0;
typedef integral_c<unsigned,1> u1;
typedef integral_c<unsigned,2> u2;
typedef integral_c<unsigned,8> u8;
typedef integral_c<unsigned,0xffffffff> uffffffff;
BOOST_MPL_ASSERT_RELATION( (bitxor_<u0,u0>::value), ==, 0 );
BOOST_MPL_ASSERT_RELATION( (bitxor_<u1,u0>::value), ==, 1 );
BOOST_MPL_ASSERT_RELATION( (bitxor_<u0,u1>::value), ==, 1 );
BOOST_MPL_ASSERT_RELATION( (bitxor_<u0,uffffffff>::value), ==, 0xffffffff ^ 0 );
BOOST_MPL_ASSERT_RELATION( (bitxor_<u1,uffffffff>::value), ==, 0xffffffff ^ 1 );
BOOST_MPL_ASSERT_RELATION( (bitxor_<u8,uffffffff>::value), ==, 0xffffffff ^ 8 );
See also
--------
|Bitwise Operations|, |Numeric Metafunction|, |numeric_cast|, |bitand_|, |bitor_|, |shift_left|
-92
View File
@@ -1,92 +0,0 @@
.. Data Types/Numeric//bool_ |10
bool\_
======
Synopsis
--------
.. parsed-literal::
template<
bool C
>
struct bool\_
{
// |unspecified|
// ...
};
typedef bool_<true> true\_;
typedef bool_<false> false\_;
Description
-----------
A boolean |Integral Constant| wrapper.
Header
------
.. parsed-literal::
#include <boost/mpl/bool.hpp>
Model of
--------
|Integral Constant|
Parameters
----------
+---------------+-------------------------------+---------------------------+
| Parameter | Requirement | Description |
+===============+===============================+===========================+
| ``C`` | A boolean integral constant | A value to wrap. |
+---------------+-------------------------------+---------------------------+
Expression semantics
--------------------
|Semantics disclaimer...| |Integral Constant|.
For arbitrary integral constant ``c``:
+-------------------+-----------------------------------------------------------+
| Expression | Semantics |
+===================+===========================================================+
| ``bool_<c>`` | An |Integral Constant| ``x`` such that ``x::value == c`` |
| | and ``x::value_type`` is identical to ``bool``. |
+-------------------+-----------------------------------------------------------+
Example
-------
.. parsed-literal::
BOOST_MPL_ASSERT(( is_same< bool_<true>::value_type, bool > ));
BOOST_MPL_ASSERT(( is_same< bool_<true>, |true_| > )); }
BOOST_MPL_ASSERT(( is_same< bool_<true>::type, bool_<true> > ));
BOOST_MPL_ASSERT_RELATION( bool_<true>::value, ==, true );
assert( bool_<true>() == true );
See also
--------
|Data Types|, |Integral Constant|, |int_|, |long_|, |integral_c|
.. |true_| replace:: |``true_``|__
.. |``true_``| replace:: ``true_``
__ `bool\_`_
.. |false_| replace:: |``false_``|__
.. |``false_``| replace:: ``false_``
__ `bool\_`_
-98
View File
@@ -1,98 +0,0 @@
.. Sequences/Intrinsic Metafunctions//clear
clear
=====
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
>
struct clear
{
typedef |unspecified| type;
};
Description
-----------
Returns an empty sequence |concept-identical| to ``Sequence``.
Header
------
.. parsed-literal::
#include <boost/mpl/clear.hpp>
Model of
--------
|Tag Dispatched Metafunction|
Parameters
----------
+---------------+-----------------------------------+---------------------------------------+
| Parameter | Requirement | Description |
+===============+===================================+=======================================+
| ``Sequence`` | |Extensible Sequence| or | A sequence to get an empty "copy" of. |
| | |Extensible Associative Sequence| | |
+---------------+-----------------------------------+---------------------------------------+
Expression semantics
--------------------
For any |Extensible Sequence| or |Extensible Associative Sequence| ``s``:
.. parsed-literal::
typedef clear<s>::type t;
:Return type:
|Extensible Sequence| or |Extensible Associative Sequence|.
:Semantics:
Equivalent to
.. parsed-literal::
typedef erase< s, begin<s>::type, end<s>::type >::type t;
:Postcondition:
``empty<s>::value == true``.
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef vector_c<int,1,3,5,7,9,11> odds;
typedef clear<odds>::type nothing;
BOOST_MPL_ASSERT(( empty<nothing> ));
See also
--------
|Extensible Sequence|, |Extensible Associative Sequence|, |erase|, |empty|, |begin|, |end|
-92
View File
@@ -1,92 +0,0 @@
.. Algorithms/Querying Algorithms//contains |30
contains
========
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
, typename T
>
struct contains
{
typedef |unspecified| type;
};
Description
-----------
Returns a true-valued |Integral Constant| if one or more elements in ``Sequence``
are identical to ``T``.
Header
------
.. parsed-literal::
#include <boost/mpl/contains.hpp>
Parameters
----------
+---------------+---------------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===================================+
| ``Sequence`` | |Forward Sequence| | A sequence to be examined. |
+---------------+---------------------------+-----------------------------------+
| ``T`` | Any type | A type to search for. |
+---------------+---------------------------+-----------------------------------+
Expression semantics
--------------------
For any |Forward Sequence| ``s`` and arbitrary type ``t``:
.. parsed-literal::
typedef contains<s,t>::type r;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
typedef not_< is_same<
find<s,t>::type
, end<s>::type
> >::type r;
Complexity
----------
Linear. At most ``size<s>::value`` comparisons for identity.
Example
-------
.. parsed-literal::
typedef vector<char,int,unsigned,long,unsigned long> types;
BOOST_MPL_ASSERT_NOT(( contains<types,bool> ));
See also
--------
|Querying Algorithms|, |find|, |find_if|, |count|, |lower_bound|
-103
View File
@@ -1,103 +0,0 @@
.. Algorithms/Transformation Algorithms//copy |10
copy
====
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
, typename In = |unspecified|
>
struct copy
{
typedef |unspecified| type;
};
Description
-----------
Returns a copy of the original sequence.
|transformation algorithm disclaimer|
Header
------
.. parsed-literal::
#include <boost/mpl/copy.hpp>
Model of
--------
|Reversible Algorithm|
Parameters
----------
+---------------+---------------------------+-------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===============================+
| ``Sequence`` | |Forward Sequence| | A sequence to copy. |
+---------------+---------------------------+-------------------------------+
| ``In`` | |Inserter| | An inserter. |
+---------------+---------------------------+-------------------------------+
Expression semantics
--------------------
|Semantics disclaimer...| |Reversible Algorithm|.
For any |Forward Sequence| ``s``, and an |Inserter| ``in``:
.. parsed-literal::
typedef copy<s,in>::type r;
:Return type:
A type.
:Semantics:
Equivalent to
.. parsed-literal::
typedef fold< s,in::state,in::operation >::type r;
Complexity
----------
Linear. Exactly ``size<s>::value`` applications of ``in::operation``.
Example
-------
.. parsed-literal::
typedef vector_c<int,0,1,2,3,4,5,6,7,8,9> numbers;
typedef copy<
range_c<int,10,20>
, back_inserter< numbers >
>::type result;
BOOST_MPL_ASSERT_RELATION( size<result>::value, ==, 20 );
BOOST_MPL_ASSERT(( equal< result,range_c<int,0,20> > ));
See also
--------
|Transformation Algorithms|, |Reversible Algorithm|, |reverse_copy|, |copy_if|, |transform|
-120
View File
@@ -1,120 +0,0 @@
.. Algorithms/Transformation Algorithms//copy_if |20
copy_if
=======
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
, typename Pred
, typename In = |unspecified|
>
struct copy_if
{
typedef |unspecified| type;
};
Description
-----------
Returns a filtered copy of the original sequence containing the elements that satisfy
the predicate ``Pred``.
|transformation algorithm disclaimer|
Header
------
.. parsed-literal::
#include <boost/mpl/copy_if.hpp>
Model of
--------
|Reversible Algorithm|
Parameters
----------
+---------------+-------------------------------+-------------------------------+
| Parameter | Requirement | Description |
+===============+===============================+===============================+
| ``Sequence`` | |Forward Sequence| | A sequence to copy. |
+---------------+-------------------------------+-------------------------------+
| ``Pred`` | Unary |Lambda Expression| | A copying condition. |
+---------------+-------------------------------+-------------------------------+
| ``In`` | |Inserter| | An inserter. |
+---------------+-------------------------------+-------------------------------+
Expression semantics
--------------------
|Semantics disclaimer...| |Reversible Algorithm|.
For any |Forward Sequence| ``s``, an unary |Lambda Expression| ``pred``, and
an |Inserter| ``in``:
.. parsed-literal::
typedef copy_if<s,pred,in>::type r;
:Return type:
A type.
:Semantics:
Equivalent to
.. parsed-literal::
typedef lambda<pred>::type p;
typedef lambda<in::operation>::type op;
typedef fold<
s
, in::state
, eval_if<
apply_wrap\ ``1``\<p,_2>
, apply_wrap\ ``2``\<op,_1,_2>
, identity<_1>
>
>::type r;
Complexity
----------
Linear. Exactly ``size<s>::value`` applications of ``pred``, and at
most ``size<s>::value`` applications of ``in::operation``.
Example
-------
.. parsed-literal::
typedef copy_if<
range_c<int,0,10>
, less< _1, int_<5> >
, back_inserter< vector<> >
>::type result;
BOOST_MPL_ASSERT_RELATION( size<result>::value, ==, 5 );
BOOST_MPL_ASSERT(( equal<result,range_c<int,0,5> > ));
See also
--------
|Transformation Algorithms|, |Reversible Algorithm|, |reverse_copy_if|, |copy|, |remove_if|, |replace_if|
-90
View File
@@ -1,90 +0,0 @@
.. Algorithms/Querying Algorithms//count |40
count
=====
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
, typename T
>
struct count
{
typedef |unspecified| type;
};
Description
-----------
Returns the number of elements in a ``Sequence`` that are identical to ``T``.
Header
------
.. parsed-literal::
#include <boost/mpl/count.hpp>
Parameters
----------
+---------------+---------------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===================================+
| ``Sequence`` | |Forward Sequence| | A sequence to be examined. |
+---------------+---------------------------+-----------------------------------+
| ``T`` | Any type | A type to search for. |
+---------------+---------------------------+-----------------------------------+
Expression semantics
--------------------
For any |Forward Sequence| ``s`` and arbitrary type ``t``:
.. parsed-literal::
typedef count<s,t>::type n;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
typedef count_if< s,is_same<_,T> >::type n;
Complexity
----------
Linear. Exactly ``size<s>::value`` comparisons for identity.
Example
-------
.. parsed-literal::
typedef vector<int,char,long,short,char,short,double,long> types;
typedef count<types, short>::type n;
BOOST_MPL_ASSERT_RELATION( n::value, ==, 2 );
See also
--------
|Querying Algorithms|, |count_if|, |find|, |find_if|, |contains|, |lower_bound|
-96
View File
@@ -1,96 +0,0 @@
.. Algorithms/Querying Algorithms//count_if |50
count_if
========
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
, typename Pred
>
struct count_if
{
typedef |unspecified| type;
};
Description
-----------
Returns the number of elements in ``Sequence`` that satisfy the predicate ``Pred``.
Header
------
.. parsed-literal::
#include <boost/mpl/count_if.hpp>
Parameters
----------
+---------------+-------------------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===============+===============================+===================================+
| ``Sequence`` | |Forward Sequence| | A sequence to be examined. |
+---------------+-------------------------------+-----------------------------------+
| ``Pred`` | Unary |Lambda Expression| | A count condition. |
+---------------+-------------------------------+-----------------------------------+
Expression semantics
--------------------
For any |Forward Sequence| ``s`` and unary |Lambda Expression| ``pred``:
.. parsed-literal::
typedef count_if<s,pred>::type n;
:Return type:
|Integral Constant|.
:Semantics:
Equivalent to
.. parsed-literal::
typedef lambda<pred>::type p;
typedef fold<
s
, long_<0>
, if_< apply_wrap\ ``1``\<p,_2>, next<_1>, _1 >
>::type n;
Complexity
----------
Linear. Exactly ``size<s>::value`` applications of ``pred``.
Example
-------
.. parsed-literal::
typedef vector<int,char,long,short,char,long,double,long> types;
BOOST_MPL_ASSERT_RELATION( (count_if< types, is_float<_> >::value), ==, 1 );
BOOST_MPL_ASSERT_RELATION( (count_if< types, is_same<_,char> >::value), ==, 2 );
BOOST_MPL_ASSERT_RELATION( (count_if< types, is_same<_,void> >::value), ==, 0 );
See also
--------
|Querying Algorithms|, |count|, |find|, |find_if|, |contains|
-55
View File
@@ -1,55 +0,0 @@
.. Sequences/Classes//deque |30
deque
=====
Description
-----------
``deque`` is a |variadic|, `random access`__, `extensible`__ sequence of types that
supports constant-time insertion and removal of elements at both ends, and
linear-time insertion and removal of elements in the middle. In this implementation
of the library, ``deque`` is a synonym for |vector|.
__ `Random Access Sequence`_
__ `Extensible Sequence`_
Header
------
.. parsed-literal::
#include <boost/mpl/deque.hpp>
Model of
--------
* |Variadic Sequence|
* |Random Access Sequence|
* |Extensible Sequence|
* |Back Extensible Sequence|
* |Front Extensible Sequence|
Expression semantics
--------------------
See |vector| specification.
Example
-------
.. parsed-literal::
typedef deque<float,double,long double> floats;
typedef push_back<floats,int>::type types;
BOOST_MPL_ASSERT(( |is_same|\< at_c<types,3>::type, int > ));
See also
--------
|Sequences|, |vector|, |list|, |set|
-94
View File
@@ -1,94 +0,0 @@
.. Iterators/Iterator Metafunctions//deref |50
deref
=====
Synopsis
--------
.. parsed-literal::
template<
typename Iterator
>
struct deref
{
typedef |unspecified| type;
};
Description
-----------
Dereferences an iterator.
Header
------
.. parsed-literal::
#include <boost/mpl/deref.hpp>
Parameters
----------
+---------------+---------------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===================================+
| ``Iterator`` | |Forward Iterator| | The iterator to dereference. |
+---------------+---------------------------+-----------------------------------+
Expression semantics
--------------------
For any |Forward Iterator|\ s ``iter``:
.. parsed-literal::
typedef deref<iter>::type t;
:Return type:
A type.
:Precondition:
``iter`` is dereferenceable.
:Semantics:
``t`` is identical to the element referenced by ``iter``. If ``iter`` is
a user-defined iterator, the library-provided default implementation is
equivalent to
.. parsed-literal::
typedef iter::type t;
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef vector<char,short,int,long> types;
typedef begin<types>::type iter;
BOOST_MPL_ASSERT(( is_same< deref<iter>::type, char > ));
See also
--------
|Iterators|, |begin| / |end|, |next|
-107
View File
@@ -1,107 +0,0 @@
.. Iterators/Iterator Metafunctions//distance |20
distance
========
Synopsis
--------
.. parsed-literal::
template<
typename First
, typename Last
>
struct distance
{
typedef |unspecified| type;
};
Description
-----------
Returns the distance between ``First`` and ``Last`` iterators, that is, an
|Integral Constant| ``n`` such that ``advance<First,n>::type`` is
identical to ``Last``.
Header
------
.. parsed-literal::
#include <boost/mpl/distance.hpp>
Parameters
----------
+---------------+---------------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===================================+
| ``First``, | |Forward Iterator| | Iterators to compute a |
| ``Last`` | | distance between. |
+---------------+---------------------------+-----------------------------------+
Model Of
--------
|Tag Dispatched Metafunction|
Expression semantics
--------------------
For any |Forward Iterator|\ s ``first`` and ``last``:
.. parsed-literal::
typedef distance<first,last>::type n;
:Return type:
|Integral Constant|.
:Precondition:
[``first``, ``last``) is a valid range.
:Semantics:
Equivalent to
.. parsed-literal::
typedef iter_fold<
iterator_range<first,last>
, long_<0>
, next<_1>
>::type n;
:Postcondition:
``is_same< advance<first,n>::type, last >::value == true``.
Complexity
----------
Amortized constant time if ``first`` and ``last`` are |Random Access Iterator|\ s,
otherwise linear time.
Example
-------
.. parsed-literal::
typedef range_c<int,0,10>::type range;
typedef begin<range>::type first;
typedef end<range>::type last;
BOOST_MPL_ASSERT_RELATION( (distance<first,last>::value), ==, 10);
See also
--------
|Iterators|, |Tag Dispatched Metafunction|, |advance|, |next|, |prior|
-125
View File
@@ -1,125 +0,0 @@
.. Metafunctions/Arithmetic Operations//divides |40
divides
=======
Synopsis
--------
.. parsed-literal::
template<
typename T1
, typename T2
, typename T3 = |unspecified|
|...|
, typename T\ *n* = |unspecified|
>
struct divides
{
typedef |unspecified| type;
};
Description
-----------
Returns the quotient of its arguments.
Header
------
.. parsed-literal::
#include <boost/mpl/divides.hpp>
#include <boost/mpl/arithmetic.hpp>
Model of
--------
|Numeric Metafunction|
Parameters
----------
+---------------+---------------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===========================+===============================================+
| |T1...Tn| | |Integral Constant| | Operation's arguments. |
+---------------+---------------------------+-----------------------------------------------+
|Note:| |numeric metafunction note| |-- end note|
Expression semantics
--------------------
For any |Integral Constant|\ s |c1...cn|:
.. parsed-literal::
typedef divides<c1,\ |...|\ c\ *n*\>::type r;
:Return type:
|Integral Constant|.
:Precondition:
``c2::value != 0``, |...| ``cn::value != 0``.
:Semantics:
Equivalent to
.. parsed-literal::
typedef integral_c<
typeof(c1::value / c2::value)
, ( c1::value / c2::value )
> c;
typedef divides<c,c3,\ |...|\c\ *n*\>::type r;
.. ..........................................................................
.. parsed-literal::
typedef divides<c1,\ |...|\ c\ *n*\> r;
:Return type:
|Integral Constant|.
:Precondition:
``c2::value != 0``, |...| ``cn::value != 0``.
:Semantics:
Equivalent to
.. parsed-literal::
struct r : divides<c1,\ |...|\ c\ *n*\>::type {};
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef divides< int_<-10>, int_<3>, long_<1> >::type r;
BOOST_MPL_ASSERT_RELATION( r::value, ==, -3 );
BOOST_MPL_ASSERT(( is_same< r::value_type, long > ));
See also
--------
|Arithmetic Operations|, |Numeric Metafunction|, |numeric_cast|, |times|, |modulus|, |plus|
-94
View File
@@ -1,94 +0,0 @@
.. Sequences/Intrinsic Metafunctions//empty
empty
=====
Synopsis
--------
.. parsed-literal::
template<
typename Sequence
>
struct empty
{
typedef |unspecified| type;
};
Description
-----------
Returns an |Integral Constant| ``c`` such that ``c::value == true`` if
and only if the sequence is empty.
Header
------
.. parsed-literal::
#include <boost/mpl/empty.hpp>
Model of
--------
|Tag Dispatched Metafunction|
Parameters
----------
+---------------+-----------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===============+=======================+===================================+
| ``Sequence`` | |Forward Sequence| | A sequence to test. |
+---------------+-----------------------+-----------------------------------+
Expression semantics
--------------------
For any |Forward Sequence| ``s``:
.. parsed-literal::
typedef empty<s>::type c;
:Return type:
Boolean |Integral Constant|.
:Semantics:
Equivalent to ``typedef is_same< begin<s>::type,end<s>::type >::type c;``.
:Postcondition:
``empty<s>::value == ( size<s>::value == 0 )``.
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef range_c<int,0,0> empty_range;
typedef vector<long,float,double> types;
BOOST_MPL_ASSERT( empty<empty_range> );
BOOST_MPL_ASSERT_NOT( empty<types> );
See also
--------
|Forward Sequence|, |Integral Constant|, |size|, |begin| / |end|
-32
View File
@@ -1,32 +0,0 @@
.. Data Types/Miscellaneous//empty_base |20
empty_base
==========
Synopsis
--------
.. parsed-literal::
struct empty_base {};
Description
-----------
An empty base class. Inheritance from |empty_base| through the |inherit|
metafunction is a no-op.
Header
------
.. parsed-literal::
#include <boost/mpl/empty_base.hpp>
See also
--------
|Data Types|, |inherit|, |inherit_linearly|, |void_|
-70
View File
@@ -1,70 +0,0 @@
.. Sequences/Views//empty_sequence
empty_sequence
==============
Synopsis
--------
.. parsed-literal::
struct empty_sequence
{
// |unspecified|
// |...|
};
Description
-----------
Represents a sequence containing no elements.
Header
------
.. parsed-literal::
#include <boost/mpl/empty_sequence.hpp>
Expression semantics
--------------------
|Semantics disclaimer...| |Random Access Sequence|.
In the following table, ``s`` is an instance of ``empty_sequence``.
+-------------------------------+-----------------------------------------------------------+
| Expression | Semantics |
+===============================+===========================================================+
| ``empty_sequence`` | An empty |Random Access Sequence|. |
+-------------------------------+-----------------------------------------------------------+
| ``size<s>::type`` | ``size<s>::value == 0``; see |Random Access Sequence|. |
+-------------------------------+-----------------------------------------------------------+
Example
-------
.. parsed-literal::
typedef begin<empty_sequence>::type first;
typedef end<empty_sequence>::type last;
BOOST_MPL_ASSERT(( is_same<first,last> ));
BOOST_MPL_ASSERT_RELATION( size<empty_sequence>::value, ==, 0 );
typedef transform_view<
empty_sequence
, add_pointer<_>
> empty_view;
BOOST_MPL_ASSERT_RELATION( size<empty_sequence>::value, ==, 0 );
See also
--------
|Sequences|, |Views|, |vector|, |list|, |single_view|
-94
View File
@@ -1,94 +0,0 @@
.. Sequences/Intrinsic Metafunctions//end
end
===
Synopsis
--------
.. parsed-literal::
template<
typename X
>
struct end
{
typedef |unspecified| type;
};
Description
-----------
Returns the sequence's past-the-end iterator. If the argument is not a
|Forward Sequence|, returns |void_|.
Header
------
.. parsed-literal::
#include <boost/mpl/begin_end.hpp>
Model of
--------
|Tag Dispatched Metafunction|
Parameters
----------
+---------------+-------------------+-----------------------------------------------+
| Parameter | Requirement | Description |
+===============+===================+===============================================+
| ``X`` | Any type | A type whose end iterator, if any, will be |
| | | returned. |
+---------------+-------------------+-----------------------------------------------+
Expression semantics
--------------------
For any arbitrary type ``x``:
.. parsed-literal::
typedef end<x>::type last;
:Return type:
|Forward Iterator| or |void_|.
:Semantics:
If ``x`` is |Forward Sequence|, ``last`` is an iterator pointing one past the
last element in ``s``; otherwise ``last`` is |void_|.
:Postcondition:
If ``last`` is an iterator, it is past-the-end.
Complexity
----------
Amortized constant time.
Example
-------
.. parsed-literal::
typedef vector<long> v;
typedef begin<v>::type first;
typedef end<v>::type last;
BOOST_MPL_ASSERT(( is_same< next<first>::type, last > ));
See also
--------
|Iterators|, |Forward Sequence|, |begin|, |end|, |next|
-93
View File
@@ -1,93 +0,0 @@
.. Algorithms/Querying Algorithms//equal |100
equal
=====
Synopsis
--------
.. parsed-literal::
template<
typename Seq1
, typename Seq2
, typename Pred = is_same<_1,_2>
>
struct equal
{
typedef |unspecified| type;
};
Description
-----------
Returns a true-valued |Integral Constant| if the two sequences ``Seq1``
and ``Seq2`` are identical when compared element-by-element.
Header
------
.. parsed-literal::
#include <boost/mpl/equal.hpp>
Parameters
----------
+-------------------+-------------------------------+-----------------------------------+
| Parameter | Requirement | Description |
+===================+===============================+===================================+
| ``Seq1``, ``Seq2``| |Forward Sequence| | Sequences to compare. |
+-------------------+-------------------------------+-----------------------------------+
| ``Pred`` | Binary |Lambda Expression| | A comparison criterion. |
+-------------------+-------------------------------+-----------------------------------+
Expression semantics
--------------------
For any |Forward Sequence|\ s ``s1`` and ``s2`` and a binary |Lambda Expression| ``pred``:
.. parsed-literal::
typedef equal<s1,s2,pred>::type c;
:Return type:
|Integral Constant|
:Semantics:
``c::value == true`` is and only if ``size<s1>::value == size<s2>::value``
and for every iterator ``i`` in |begin/end<s1>| ``deref<i>::type`` is identical to
.. parsed-literal::
advance< begin<s2>::type, distance< begin<s1>::type,i >::type >::type
Complexity
----------
Linear. At most ``size<s1>::value`` comparisons.
Example
-------
.. parsed-literal::
typedef vector<char,int,unsigned,long,unsigned long> s1;
typedef list<char,int,unsigned,long,unsigned long> s2;
BOOST_MPL_ASSERT(( equal<s1,s2> ));
See also
--------
|Querying Algorithms|, |find|, |find_if|

Some files were not shown because too many files have changed in this diff Show More