• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1.. Sequences/Views//transform_view
2
3transform_view
4==============
5
6Synopsis
7--------
8
9.. parsed-literal::
10
11    template<
12          typename Sequence
13        , typename F
14        >
15    struct transform_view
16    {
17        // |unspecified|
18        // |...|
19    };
20
21
22Description
23-----------
24
25A view the full range of ``Sequence``\ 's transformed elements.
26
27
28Header
29------
30
31.. parsed-literal::
32
33    #include <boost/mpl/transform_view.hpp>
34
35
36Model of
37--------
38
39* |Forward Sequence|
40
41
42Parameters
43----------
44
45+---------------+-------------------------------+-------------------------------+
46| Parameter     | Requirement                   | Description                   |
47+===============+===============================+===============================+
48| ``Sequence``  | |Forward Sequence|            | A sequence to wrap.           |
49+---------------+-------------------------------+-------------------------------+
50| ``F``         | Unary |Lambda Expression|     | A transformation.             |
51+---------------+-------------------------------+-------------------------------+
52
53
54Expression semantics
55--------------------
56
57|Semantics disclaimer...| |Forward Sequence|.
58
59In the following table, ``v`` is an instance of ``transform_view``, ``s`` is an arbitrary
60|Forward Sequence|, and ``f`` is an unary |Lambda Expression|.
61
62+-----------------------------------+-----------------------------------------------------------+
63| Expression                        | Semantics                                                 |
64+===================================+===========================================================+
65| .. parsed-literal::               | A lazy |Forward Sequence| such that for each ``i`` in the |
66|                                   | range |begin/end<v>| and each ``j`` in for in the range   |
67|    transform_view<s,f>            | |begin/end<s>| ``deref<i>::type`` is identical to         |
68|    transform_view<s,f>::type      | ``apply< f, deref<j>::type >::type``.                     |
69+-----------------------------------+-----------------------------------------------------------+
70| ``size<v>::type``                 | The size of ``v``;                                        |
71|                                   | ``size<v>::value == size<s>::value``;                     |
72|                                   | linear complexity; see |Forward Sequence|.                |
73+-----------------------------------+-----------------------------------------------------------+
74
75
76Example
77-------
78
79Find the largest type in a sequence.
80
81.. parsed-literal::
82
83    typedef vector<int,long,char,char[50],double> types;
84    typedef max_element<
85          transform_view< types, size_of<_> >
86        >::type iter;
87
88    BOOST_MPL_ASSERT_RELATION( deref<iter>::type::value, ==, 50 );
89
90
91See also
92--------
93
94|Sequences|, |Views|, |filter_view|, |joint_view|, |zip_view|, |iterator_range|
95
96
97.. copyright:: Copyright �  2001-2009 Aleksey Gurtovoy and David Abrahams
98   Distributed under the Boost Software License, Version 1.0. (See accompanying
99   file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
100