...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 |
---|---|---|
Sequence |
|
|
Pred |
Unary Metafunction returning an mpl::bool_ |
|
Notation
A filter_view type
Instances of filter_view
Semantics of an expression is defined only where it differs from, or is not defined in Forward Sequence.
Expression |
Semantics |
---|---|
F(s) |
Creates a filter_view given a sequence, s. |
F(f) |
Copy constructs a filter_view from another filter_view, f. |
f = f2 |
Assigns to a filter_view, f, from another filter_view, f2. |
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;