![]() |
Home | Libraries | People | FAQ | More |
transform_view presents a transformed view of its underlying sequence given a unary Polymorphic Function Object. The transform_view inherits the traversal characteristics (see Sequence Traversal Concept) of its underlying sequence.
#include <boost/fusion/sequence/view/transform_view.hpp>
Unary Version
template <typename Sequence, typename F> struct transform_view;
Binary Version
template <typename Sequence1, typename Sequence2, typename F> struct transform_view;
Parameter | Description | Default |
---|---|---|
Sequence | A Forward Sequence | |
Sequence1 | A Forward Sequence | |
Sequence2 | A Forward Sequence | |
F | A Polymorphic Function Object |
Notation
Semantics of an expression is defined only where it differs from, or is not defined in Forward Sequence, Bidirectional Sequence or Random Access Sequence depending on the traversal characteristics (see Sequence Traversal Concept) of its underlying sequence.
Expression | Semantics |
---|---|
UTV(s, f) | Creates a unary transform_view given sequence, s and unary Polymorphic Function Object, f. |
BTV(s1, s2, f) | Creates a binary transform_view given sequences, s1 and s2 and unary Polymorphic Function Object, f. |
TV(tv) | Copy constructs a transform_view from another transform_view, tv. |
tv = tv2 | Assigns to a transform_view, tv, from another transform_view, tv2. |
struct square { template <typename T> struct result { typedef T type; }; template <typename T> T operator()(T x) const { return x * x; } }; typedef vector<int, short, double> vector_type; vector_type vec(2, 5, 3.3); transform_view<vector_type, square> transform(vec, square()); std::cout << transform << std::endl;
Copyright © 2001-2005 Joel de Guzman, Dan Marsden |