// transform_view
// This code has been simplified here for the sake
// of illustration. For the real code, see:
// http://www.zib.de/weiser/vtl, or
// http://www.cuj.com
template <class Container, class Operation>
class transform_view {
Container *pCont;
Operation op;
public:
transform_view(Container &c, Operation o)
: pCont(&c), op(0) {}
typedef typename
transform_iterator<Conatiner::iterator, Operation> iterator;
iterator begin() {
return iterator(pCont->begin(), op); }
iterator end() {
return iterator(pCont->end(), op); }
// ... More member functions and operators
};
template<class Container_Iterator, class Operation>
class transform_iterator {
Containter_Iterator iter;
Operation op;
public:
transform_iterator(Conatiner_Iterator &i, Operation o)
: iter(i), op(o) {}
typedef typename
Operation::result_type result_type;
result_type operator*() {
return op(*iter); }
// ... More member functions and operators
};