]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpl/doc/src/refmanual/filter_view.rst
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / mpl / doc / src / refmanual / filter_view.rst
1 .. Sequences/Views//filter_view
2
3 filter_view
4 ===========
5
6 Synopsis
7 --------
8
9 .. parsed-literal::
10
11 template<
12 typename Sequence
13 , typename Pred
14 >
15 struct filter_view
16 {
17 // |unspecified|
18 // |...|
19 };
20
21
22
23 Description
24 -----------
25
26 A view into a subset of ``Sequence``\ 's elements satisfying the predicate ``Pred``.
27
28
29 Header
30 ------
31
32 .. parsed-literal::
33
34 #include <boost/mpl/filter_view.hpp>
35
36
37 Model of
38 --------
39
40 * |Forward Sequence|
41
42
43 Parameters
44 ----------
45
46 +---------------+-----------------------------------+-----------------------------------------------+
47 | Parameter | Requirement | Description |
48 +===============+===================================+===============================================+
49 | ``Sequence`` | |Forward Sequence| | A sequence to wrap. |
50 +---------------+-----------------------------------+-----------------------------------------------+
51 | ``Pred`` | Unary |Lambda Expression| | A filtering predicate. |
52 +---------------+-----------------------------------+-----------------------------------------------+
53
54
55 Expression semantics
56 --------------------
57
58 Semantics of an expression is defined only where it differs from, or is not
59 defined in |Forward Sequence|.
60
61 In the following table, ``v`` is an instance of ``filter_view``, ``s`` is an arbitrary
62 |Forward Sequence|, ``pred`` is an unary |Lambda Expression|.
63
64 +---------------------------------------+-----------------------------------------------------------+
65 | Expression | Semantics |
66 +=======================================+===========================================================+
67 | .. parsed-literal:: | A lazy |Forward Sequence| sequence of all the elements in |
68 | | the range |begin/end<s>| that satisfy the predicate |
69 | filter_view<s,pred> | ``pred``. |
70 | filter_view<s,pred>::type | |
71 +---------------------------------------+-----------------------------------------------------------+
72 | ``size<v>::type`` | The size of ``v``; |
73 | | ``size<v>::value == count_if<s,pred>::value``; |
74 | | linear complexity; see |Forward Sequence|. |
75 +---------------------------------------+-----------------------------------------------------------+
76
77
78 Example
79 -------
80
81 Find the largest floating type in a sequence.
82
83 .. parsed-literal::
84
85 typedef vector<int,float,long,float,char[50],long double,char> types;
86 typedef max_element<
87 transform_view< filter_view< types,boost::is_float<_> >, size_of<_> >
88 >::type iter;
89
90 BOOST_MPL_ASSERT(( is_same< deref<iter::base>::type, long double > ));
91
92
93 See also
94 --------
95
96 |Sequences|, |Views|, |transform_view|, |joint_view|, |zip_view|, |iterator_range|
97
98
99 .. copyright:: Copyright © 2001-2009 Aleksey Gurtovoy and David Abrahams
100 Distributed under the Boost Software License, Version 1.0. (See accompanying
101 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)