...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
filter_view
is a view into
a subset of its underlying sequence's elements satisfying a given predicate
(an MPL metafunction).
The filter_view
presents
only those elements for which its predicate evaluates to mpl::true_
.
#include <boost/fusion/view/filter_view.hpp> #include <boost/fusion/include/filter_view.hpp>
template <typename Sequence, typename Pred> struct filter_view;
Parameter |
Description |
Default |
---|---|---|
|
||
|
Unary Metafunction returning an |
Sequence
implements the Associative
Sequence model.
Notation
F
A filter_view
type
f
, f2
Instances of filter_view
s
Semantics of an expression is defined only where it differs from, or is not defined in the implemented models.
Expression |
Semantics |
---|---|
|
Creates a |
|
Copy constructs a |
|
Assigns to a |
using boost::mpl::_;
using boost::mpl::not_;
using boost::is_class;
typedef vector
<std::string, char, long, bool, double> vector_type;
vector_type v("a-string", '@', 987654, true, 6.6);
filter_view<vector_type const, not_<is_class<_> > > view(v);
std::cout << view << std::endl;