mirror of
https://github.com/boostorg/mpl.git
synced 2025-08-24 00:41:07 +02:00
Document for_each
[SVN r34978]
This commit is contained in:
10
doc/src/refmanual/Algorithms-Runtime.rst
Normal file
10
doc/src/refmanual/Algorithms-Runtime.rst
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
.. The MPL *runtime algorithms* provide out-of-box support for the
|
||||||
|
common scenarios of crossing compile time/runtime boundary.
|
||||||
|
|
||||||
|
.. |Runtime Algorithms| replace:: `Runtime Algorithms`_
|
||||||
|
|
||||||
|
.. |runtime algorithm| replace:: `runtime algorithm`_
|
||||||
|
.. _runtime algorithm: `Runtime Algorithms`_
|
||||||
|
.. |runtime algorithms| replace:: `runtime algorithms`_
|
||||||
|
|
10
doc/src/refmanual/Attic/Algorithms-Runtime.rst
Normal file
10
doc/src/refmanual/Attic/Algorithms-Runtime.rst
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
|
||||||
|
.. The MPL *runtime algorithms* provide out-of-box support for the
|
||||||
|
common scenarios of crossing compile time/runtime boundary.
|
||||||
|
|
||||||
|
.. |Runtime Algorithms| replace:: `Runtime Algorithms`_
|
||||||
|
|
||||||
|
.. |runtime algorithm| replace:: `runtime algorithm`_
|
||||||
|
.. _runtime algorithm: `Runtime Algorithms`_
|
||||||
|
.. |runtime algorithms| replace:: `runtime algorithms`_
|
||||||
|
|
140
doc/src/refmanual/Attic/for_each.rst
Normal file
140
doc/src/refmanual/Attic/for_each.rst
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
.. Algorithms/Runtime Algorithms//for_each |10
|
||||||
|
|
||||||
|
for_each
|
||||||
|
========
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename Sequence
|
||||||
|
, typename F
|
||||||
|
>
|
||||||
|
void for_each( F f );
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename Sequence
|
||||||
|
, typename TransformOp
|
||||||
|
, typename F
|
||||||
|
>
|
||||||
|
void for_each( F f );
|
||||||
|
|
||||||
|
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
|
||||||
|
``for_each`` is a family of overloaded function templates:
|
||||||
|
|
||||||
|
* ``for_each<Sequence>( f )`` applies the runtime function object
|
||||||
|
``f`` to every element in the |begin/end<Sequence>| range.
|
||||||
|
|
||||||
|
* ``for_each<Sequence,TransformOp>( f )`` applies the runtime function
|
||||||
|
object ``f`` to the result of the transformation ``TransformOp`` of
|
||||||
|
every element in the |begin/end<Sequence>| range.
|
||||||
|
|
||||||
|
|
||||||
|
Header
|
||||||
|
------
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
#include <boost/mpl/for_each.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
| Parameter | Requirement | Description |
|
||||||
|
+===================+===================================+===================================+
|
||||||
|
| ``Sequence`` | |Forward Sequence| | A sequence to iterate. |
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
| ``TransformOp`` | |Lambda Expression| | A transformation. |
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
| ``f`` | An |unary function object| | A runtime operation to apply. |
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
|
||||||
|
|
||||||
|
Expression semantics
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
For any |Forward Sequence| ``s``, |Lambda Expression| ``op`` , and an
|
||||||
|
|unary function object| ``f``:
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
for_each<s>( f );
|
||||||
|
|
||||||
|
:Return type:
|
||||||
|
``void``
|
||||||
|
|
||||||
|
:Postcondition:
|
||||||
|
Equivalent to
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
typedef begin<Sequence>::type i\ :sub:`1`;
|
||||||
|
|value_initialized|< deref<i\ :sub:`1`>::type > x\ :sub:`1`;
|
||||||
|
f(boost::get(x\ :sub:`1`));
|
||||||
|
|
||||||
|
typedef next<i\ :sub:`1`>::type i\ :sub:`2`;
|
||||||
|
|value_initialized|< deref<i\ :sub:`2`>::type > x\ :sub:`2`;
|
||||||
|
f(boost::get(x\ :sub:`2`));
|
||||||
|
|...|
|
||||||
|
|value_initialized|< deref<i\ :sub:`n`>::type > x\ :sub:`n`;
|
||||||
|
f(boost::get(x\ :sub:`n`));
|
||||||
|
typedef next<i\ :sub:`n`>::type last;
|
||||||
|
|
||||||
|
where ``n == size<s>::value`` and ``last`` is identical to
|
||||||
|
``end<s>::type``; no effect if ``empty<s>::value == true``.
|
||||||
|
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
for_each<s,op>( f );
|
||||||
|
|
||||||
|
:Return type:
|
||||||
|
``void``
|
||||||
|
|
||||||
|
:Postcondition:
|
||||||
|
Equivalent to
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
for_each< tranform_view<s,op> >( f );
|
||||||
|
|
||||||
|
|
||||||
|
Complexity
|
||||||
|
----------
|
||||||
|
|
||||||
|
Linear. Exactly ``size<s>::value`` applications of ``op`` and ``f``.
|
||||||
|
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
struct value_printer
|
||||||
|
{
|
||||||
|
template< typename U > void operator()(U x)
|
||||||
|
{
|
||||||
|
std::cout << x << '\n';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
for_each< range_c<int,0,10> >( value_printer() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
See also
|
||||||
|
--------
|
||||||
|
|
||||||
|
|Runtime Algorithms|, |Views|, |transform_view|
|
||||||
|
|
||||||
|
.. |unary function object| replace:: `unary function object <http://www.sgi.com/tech/stl/UnaryFunction.html>`_
|
||||||
|
.. |value_initialized| replace:: `value_initialized <http://www.boost.org/libs/utility/value_init.htm>`_
|
71
doc/src/refmanual/IntegralConstant.rst.~1.1.~
Normal file
71
doc/src/refmanual/IntegralConstant.rst.~1.1.~
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
.. 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|
|
||||||
|
|
23
doc/src/refmanual/concepts.gen
Normal file
23
doc/src/refmanual/concepts.gen
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
* |Associative Sequence|
|
||||||
|
* |Back Extensible Sequence|
|
||||||
|
* |Bidirectional Iterator|
|
||||||
|
* |Bidirectional Sequence|
|
||||||
|
* |Extensible Associative Sequence|
|
||||||
|
* |Extensible Sequence|
|
||||||
|
* |Forward Iterator|
|
||||||
|
* |Forward Sequence|
|
||||||
|
* |Front Extensible Sequence|
|
||||||
|
* |Inserter|
|
||||||
|
* |Integral Constant|
|
||||||
|
* |Integral Sequence Wrapper|
|
||||||
|
* |Lambda Expression|
|
||||||
|
* |Metafunction|
|
||||||
|
* |Metafunction Class|
|
||||||
|
* |Numeric Metafunction|
|
||||||
|
* |Placeholder Expression|
|
||||||
|
* |Random Access Iterator|
|
||||||
|
* |Random Access Sequence|
|
||||||
|
* |Reversible Algorithm|
|
||||||
|
* |Tag Dispatched Metafunction|
|
||||||
|
* |Trivial Metafunction|
|
||||||
|
* |Variadic Sequence|
|
140
doc/src/refmanual/for_each.rst
Normal file
140
doc/src/refmanual/for_each.rst
Normal file
@@ -0,0 +1,140 @@
|
|||||||
|
.. Algorithms/Runtime Algorithms//for_each |10
|
||||||
|
|
||||||
|
for_each
|
||||||
|
========
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename Sequence
|
||||||
|
, typename F
|
||||||
|
>
|
||||||
|
void for_each( F f );
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename Sequence
|
||||||
|
, typename TransformOp
|
||||||
|
, typename F
|
||||||
|
>
|
||||||
|
void for_each( F f );
|
||||||
|
|
||||||
|
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
|
||||||
|
``for_each`` is a family of overloaded function templates:
|
||||||
|
|
||||||
|
* ``for_each<Sequence>( f )`` applies the runtime function object
|
||||||
|
``f`` to every element in the |begin/end<Sequence>| range.
|
||||||
|
|
||||||
|
* ``for_each<Sequence,TransformOp>( f )`` applies the runtime function
|
||||||
|
object ``f`` to the result of the transformation ``TransformOp`` of
|
||||||
|
every element in the |begin/end<Sequence>| range.
|
||||||
|
|
||||||
|
|
||||||
|
Header
|
||||||
|
------
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
#include <boost/mpl/for_each.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
| Parameter | Requirement | Description |
|
||||||
|
+===================+===================================+===================================+
|
||||||
|
| ``Sequence`` | |Forward Sequence| | A sequence to iterate. |
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
| ``TransformOp`` | |Lambda Expression| | A transformation. |
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
| ``f`` | An |unary function object| | A runtime operation to apply. |
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
|
||||||
|
|
||||||
|
Expression semantics
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
For any |Forward Sequence| ``s``, |Lambda Expression| ``op`` , and an
|
||||||
|
|unary function object| ``f``:
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
for_each<s>( f );
|
||||||
|
|
||||||
|
:Return type:
|
||||||
|
``void``
|
||||||
|
|
||||||
|
:Postcondition:
|
||||||
|
Equivalent to
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
typedef begin<Sequence>::type i\ :sub:`1`;
|
||||||
|
|value_initialized|< deref<i\ :sub:`1`>::type > x\ :sub:`1`;
|
||||||
|
f(boost::get(x\ :sub:`1`));
|
||||||
|
|
||||||
|
typedef next<i\ :sub:`1`>::type i\ :sub:`2`;
|
||||||
|
|value_initialized|< deref<i\ :sub:`2`>::type > x\ :sub:`2`;
|
||||||
|
f(boost::get(x\ :sub:`2`));
|
||||||
|
|...|
|
||||||
|
|value_initialized|< deref<i\ :sub:`n`>::type > x\ :sub:`n`;
|
||||||
|
f(boost::get(x\ :sub:`n`));
|
||||||
|
typedef next<i\ :sub:`n`>::type last;
|
||||||
|
|
||||||
|
where ``n == size<s>::value`` and ``last`` is identical to
|
||||||
|
``end<s>::type``; no effect if ``empty<s>::value == true``.
|
||||||
|
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
for_each<s,op>( f );
|
||||||
|
|
||||||
|
:Return type:
|
||||||
|
``void``
|
||||||
|
|
||||||
|
:Postcondition:
|
||||||
|
Equivalent to
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
for_each< tranform_view<s,op> >( f );
|
||||||
|
|
||||||
|
|
||||||
|
Complexity
|
||||||
|
----------
|
||||||
|
|
||||||
|
Linear. Exactly ``size<s>::value`` applications of ``op`` and ``f``.
|
||||||
|
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
struct value_printer
|
||||||
|
{
|
||||||
|
template< typename U > void operator()(U x)
|
||||||
|
{
|
||||||
|
std::cout << x << '\n';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
for_each< range_c<int,0,10> >( value_printer() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
See also
|
||||||
|
--------
|
||||||
|
|
||||||
|
|Runtime Algorithms|, |Views|, |transform_view|
|
||||||
|
|
||||||
|
.. |unary function object| replace:: `unary function object <http://www.sgi.com/tech/stl/UnaryFunction.html>`_
|
||||||
|
.. |value_initialized| replace:: `value_initialized <http://www.boost.org/libs/utility/value_init.htm>`_
|
150
doc/src/refmanual/index.gen
Normal file
150
doc/src/refmanual/index.gen
Normal file
@@ -0,0 +1,150 @@
|
|||||||
|
* |BOOST_MPL_ASSERT|
|
||||||
|
* |BOOST_MPL_ASSERT_MSG|
|
||||||
|
* |BOOST_MPL_ASSERT_NOT|
|
||||||
|
* |BOOST_MPL_ASSERT_RELATION|
|
||||||
|
* |BOOST_MPL_AUX_LAMBDA_SUPPORT|
|
||||||
|
* |BOOST_MPL_CFG_NO_HAS_XXX|
|
||||||
|
* |BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS|
|
||||||
|
* |BOOST_MPL_HAS_XXX_TRAIT_DEF|
|
||||||
|
* |BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF|
|
||||||
|
* |BOOST_MPL_LIMIT_LIST_SIZE|
|
||||||
|
* |BOOST_MPL_LIMIT_MAP_SIZE|
|
||||||
|
* |BOOST_MPL_LIMIT_METAFUNCTION_ARITY|
|
||||||
|
* |BOOST_MPL_LIMIT_SET_SIZE|
|
||||||
|
* |BOOST_MPL_LIMIT_UNROLLING|
|
||||||
|
* |BOOST_MPL_LIMIT_VECTOR_SIZE|
|
||||||
|
* |_1,_2,..._n|
|
||||||
|
* |accumulate|
|
||||||
|
* |advance|
|
||||||
|
* |always|
|
||||||
|
* |and_|
|
||||||
|
* |apply|
|
||||||
|
* |apply_wrap|
|
||||||
|
* |arg|
|
||||||
|
* |at|
|
||||||
|
* |at_c|
|
||||||
|
* |back|
|
||||||
|
* |back_inserter|
|
||||||
|
* |begin|
|
||||||
|
* |bind|
|
||||||
|
* |bitand_|
|
||||||
|
* |bitor_|
|
||||||
|
* |bitxor_|
|
||||||
|
* |bool_|
|
||||||
|
* |clear|
|
||||||
|
* |contains|
|
||||||
|
* |copy|
|
||||||
|
* |copy_if|
|
||||||
|
* |count|
|
||||||
|
* |count_if|
|
||||||
|
* |deque|
|
||||||
|
* |deref|
|
||||||
|
* |distance|
|
||||||
|
* |divides|
|
||||||
|
* |empty|
|
||||||
|
* |empty_base|
|
||||||
|
* |empty_sequence|
|
||||||
|
* |end|
|
||||||
|
* |equal|
|
||||||
|
* |equal_to|
|
||||||
|
* |erase|
|
||||||
|
* |erase_key|
|
||||||
|
* |eval_if|
|
||||||
|
* |eval_if_c|
|
||||||
|
* |filter_view|
|
||||||
|
* |find|
|
||||||
|
* |find_if|
|
||||||
|
* |fold|
|
||||||
|
* |for_each|
|
||||||
|
* |front|
|
||||||
|
* |front_inserter|
|
||||||
|
* |greater|
|
||||||
|
* |greater_equal|
|
||||||
|
* |has_key|
|
||||||
|
* |identity|
|
||||||
|
* |if_|
|
||||||
|
* |if_c|
|
||||||
|
* |inherit|
|
||||||
|
* |inherit_linearly|
|
||||||
|
* |insert|
|
||||||
|
* |insert_range|
|
||||||
|
* |inserter|
|
||||||
|
* |int_|
|
||||||
|
* |integral_c|
|
||||||
|
* |is_sequence|
|
||||||
|
* |iter_fold|
|
||||||
|
* |iterator_category|
|
||||||
|
* |iterator_range|
|
||||||
|
* |joint_view|
|
||||||
|
* |key_type|
|
||||||
|
* |lambda|
|
||||||
|
* |less|
|
||||||
|
* |less_equal|
|
||||||
|
* |list|
|
||||||
|
* |list_c|
|
||||||
|
* |long_|
|
||||||
|
* |lower_bound|
|
||||||
|
* |map|
|
||||||
|
* |max|
|
||||||
|
* |max_element|
|
||||||
|
* |min|
|
||||||
|
* |min_element|
|
||||||
|
* |minus|
|
||||||
|
* |modulus|
|
||||||
|
* |negate|
|
||||||
|
* |next|
|
||||||
|
* |not_|
|
||||||
|
* |not_equal_to|
|
||||||
|
* |numeric_cast|
|
||||||
|
* |or_|
|
||||||
|
* |order|
|
||||||
|
* |pair|
|
||||||
|
* |partition|
|
||||||
|
* |plus|
|
||||||
|
* |pop_back|
|
||||||
|
* |pop_front|
|
||||||
|
* |prior|
|
||||||
|
* |protect|
|
||||||
|
* |push_back|
|
||||||
|
* |push_front|
|
||||||
|
* |quote|
|
||||||
|
* |range_c|
|
||||||
|
* |remove|
|
||||||
|
* |remove_if|
|
||||||
|
* |replace|
|
||||||
|
* |replace_if|
|
||||||
|
* |reverse|
|
||||||
|
* |reverse_copy|
|
||||||
|
* |reverse_copy_if|
|
||||||
|
* |reverse_fold|
|
||||||
|
* |reverse_iter_fold|
|
||||||
|
* |reverse_partition|
|
||||||
|
* |reverse_remove|
|
||||||
|
* |reverse_remove_if|
|
||||||
|
* |reverse_replace|
|
||||||
|
* |reverse_replace_if|
|
||||||
|
* |reverse_stable_partition|
|
||||||
|
* |reverse_transform|
|
||||||
|
* |reverse_unique|
|
||||||
|
* |sequence_tag|
|
||||||
|
* |set|
|
||||||
|
* |set_c|
|
||||||
|
* |shift_left|
|
||||||
|
* |shift_right|
|
||||||
|
* |single_view|
|
||||||
|
* |size|
|
||||||
|
* |size_t|
|
||||||
|
* |sizeof_|
|
||||||
|
* |sort|
|
||||||
|
* |stable_partition|
|
||||||
|
* |times|
|
||||||
|
* |transform|
|
||||||
|
* |transform_view|
|
||||||
|
* |unique|
|
||||||
|
* |unpack_args|
|
||||||
|
* |upper_bound|
|
||||||
|
* |value_type|
|
||||||
|
* |vector|
|
||||||
|
* |vector_c|
|
||||||
|
* |void_|
|
||||||
|
* |zip_view|
|
1418
doc/src/refmanual/refmanual.gen
Normal file
1418
doc/src/refmanual/refmanual.gen
Normal file
File diff suppressed because it is too large
Load Diff
@@ -12,6 +12,7 @@ Algorithms/Inserters
|
|||||||
Algorithms/Iteration Algorithms
|
Algorithms/Iteration Algorithms
|
||||||
Algorithms/Querying Algorithms
|
Algorithms/Querying Algorithms
|
||||||
Algorithms/Transformation Algorithms
|
Algorithms/Transformation Algorithms
|
||||||
|
Algorithms/Runtime Algorithms
|
||||||
Metafunctions
|
Metafunctions
|
||||||
Metafunctions/Concepts
|
Metafunctions/Concepts
|
||||||
Metafunctions/Type Selection
|
Metafunctions/Type Selection
|
||||||
|
37
doc/src/refmanual/refmanual.toc.~1.1.~
Normal file
37
doc/src/refmanual/refmanual.toc.~1.1.~
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
Sequences
|
||||||
|
Sequences/Concepts
|
||||||
|
Sequences/Classes
|
||||||
|
Sequences/Views
|
||||||
|
Sequences/Intrinsic Metafunctions
|
||||||
|
Iterators
|
||||||
|
Iterators/Concepts
|
||||||
|
Iterators/Iterator Metafunctions
|
||||||
|
Algorithms
|
||||||
|
Algorithms/Concepts
|
||||||
|
Algorithms/Inserters
|
||||||
|
Algorithms/Iteration Algorithms
|
||||||
|
Algorithms/Querying Algorithms
|
||||||
|
Algorithms/Transformation Algorithms
|
||||||
|
Metafunctions
|
||||||
|
Metafunctions/Concepts
|
||||||
|
Metafunctions/Type Selection
|
||||||
|
Metafunctions/Invocation
|
||||||
|
Metafunctions/Composition and Argument Binding
|
||||||
|
Metafunctions/Arithmetic Operations
|
||||||
|
Metafunctions/Comparisons
|
||||||
|
Metafunctions/Logical Operations
|
||||||
|
Metafunctions/Bitwise Operations
|
||||||
|
Metafunctions/Trivial
|
||||||
|
Metafunctions/Miscellaneous
|
||||||
|
Data Types
|
||||||
|
Data Types/Concepts
|
||||||
|
Data Types/Numeric
|
||||||
|
Data Types/Miscellaneous
|
||||||
|
Macros
|
||||||
|
Macros/Asserts
|
||||||
|
Macros/Introspection
|
||||||
|
Macros/Configuration
|
||||||
|
Macros/Broken Compiler Workarounds
|
||||||
|
Terminology
|
||||||
|
Categorized Index
|
||||||
|
Acknowledgements
|
157
doc/src/refmanual/transform.rst.~1.1.~
Normal file
157
doc/src/refmanual/transform.rst.~1.1.~
Normal file
@@ -0,0 +1,157 @@
|
|||||||
|
.. Algorithms/Transformation Algorithms//transform |30
|
||||||
|
|
||||||
|
transform
|
||||||
|
=========
|
||||||
|
|
||||||
|
Synopsis
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename Seq
|
||||||
|
, typename Op
|
||||||
|
, typename In = |unspecified|
|
||||||
|
>
|
||||||
|
struct transform
|
||||||
|
{
|
||||||
|
typedef |unspecified| type;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<
|
||||||
|
typename Seq1
|
||||||
|
, typename Seq2
|
||||||
|
, typename BinaryOp
|
||||||
|
, typename In = |unspecified|
|
||||||
|
>
|
||||||
|
struct transform
|
||||||
|
{
|
||||||
|
typedef |unspecified| type;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Description
|
||||||
|
-----------
|
||||||
|
|
||||||
|
``transform`` is an |overloaded name|:
|
||||||
|
|
||||||
|
* ``transform<Seq,Op>`` returns a transformed copy of the original sequence
|
||||||
|
produced by applying an unary transformation ``Op`` to every element
|
||||||
|
in the |begin/end<Sequence>| range.
|
||||||
|
|
||||||
|
* ``transform<Seq1,Seq2,Op>`` returns a new sequence produced by applying a
|
||||||
|
binary transformation ``BinaryOp`` to a pair of elements (e\ :sub:`1`, e2\ :sub:`1`)
|
||||||
|
from the corresponding |begin/end<Seq1>| and |begin/end<Seq2>| ranges.
|
||||||
|
|
||||||
|
|transformation algorithm disclaimer|
|
||||||
|
|
||||||
|
|
||||||
|
Header
|
||||||
|
------
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
#include <boost/mpl/transform.hpp>
|
||||||
|
|
||||||
|
|
||||||
|
Model of
|
||||||
|
--------
|
||||||
|
|
||||||
|
|Reversible Algorithm|
|
||||||
|
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
| Parameter | Requirement | Description |
|
||||||
|
+===================+===================================+===================================+
|
||||||
|
| ``Sequence``, | |Forward Sequence| | Sequences to transform. |
|
||||||
|
| ``Seq1``, ``Seq2``| | |
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
| ``Op``, | |Lambda Expression| | A transformation. |
|
||||||
|
| ``BinaryOp`` | | |
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
| ``In`` | |Inserter| | An inserter. |
|
||||||
|
+-------------------+-----------------------------------+-----------------------------------+
|
||||||
|
|
||||||
|
|
||||||
|
Expression semantics
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
|Semantics disclaimer...| |Reversible Algorithm|.
|
||||||
|
|
||||||
|
For any |Forward Sequence|\ s ``s``, ``s1`` and ``s2``, |Lambda Expression|\ s ``op`` and ``op2``,
|
||||||
|
and an |Inserter| ``in``:
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
typedef transform<s,op,in>::type r;
|
||||||
|
|
||||||
|
:Return type:
|
||||||
|
A type.
|
||||||
|
|
||||||
|
:Postcondition:
|
||||||
|
Equivalent to
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
typedef lambda<op>::type f;
|
||||||
|
typedef lambda<in::operation>::type in_op;
|
||||||
|
|
||||||
|
typedef fold<
|
||||||
|
s
|
||||||
|
, in::state
|
||||||
|
, bind< in_op, _1, bind<f, _2> >
|
||||||
|
>::type r;
|
||||||
|
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
typedef transform<s1,s2,op,in>::type r;
|
||||||
|
|
||||||
|
:Return type:
|
||||||
|
A type.
|
||||||
|
|
||||||
|
:Postcondition:
|
||||||
|
Equivalent to
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
typedef lambda<op2>::type f;
|
||||||
|
typedef lambda<in::operation>::type in_op;
|
||||||
|
|
||||||
|
typedef fold<
|
||||||
|
pair_view<s1,s2>
|
||||||
|
, in::state
|
||||||
|
, bind<
|
||||||
|
in_op
|
||||||
|
, _1
|
||||||
|
, bind<f, bind<first<>,_2>, bind<second<>,_2> >
|
||||||
|
>
|
||||||
|
>::type r;
|
||||||
|
|
||||||
|
|
||||||
|
Complexity
|
||||||
|
----------
|
||||||
|
|
||||||
|
Linear. Exactly ``size<s>::value`` / ``size<s1>::value`` applications of
|
||||||
|
``op`` / ``op2`` and ``in::operation``.
|
||||||
|
|
||||||
|
|
||||||
|
Example
|
||||||
|
-------
|
||||||
|
|
||||||
|
.. parsed-literal::
|
||||||
|
|
||||||
|
typedef vector<char,short,int,long,float,double> types;
|
||||||
|
typedef vector<char*,short*,int*,long*,float*,double*> pointers;
|
||||||
|
typedef transform< types,boost::add_pointer<_1> >::type result;
|
||||||
|
|
||||||
|
BOOST_MPL_ASSERT(( equal<result,pointers> ));
|
||||||
|
|
||||||
|
|
||||||
|
See also
|
||||||
|
--------
|
||||||
|
|
||||||
|
|Transformation Algorithms|, |Reversible Algorithm|, |reverse_transform|, |copy|, |replace_if|
|
Reference in New Issue
Block a user