Boost logo

Boost Users :

From: Mike Gibson (megibson_at_[hidden])
Date: 2005-07-22 11:06:21


Does such a thing exist? So you could the following (with
some_iterator begin the 'thing'):

template <typename Value>
class some_iterator
{
   ...magic...
};

void f(some_iterator<int> begin, some_iterator<int> end)
{
   ...do something cool with begin and end...
}

int double_int(int i) { return i * 2; }

int main()
{
   std::vector<int> vec_int;

   ...fill vec_int...

   f(
      make_some_iterator(vec_int.begin()),
      make_some_iterator(vec_int.end()));

   f(
      make_some_iterator(
         make_transform_iterator(vec_int.begin(), double_int)),
      make_some_iterator(
         make_transform_iterator(vec_int.end(), double_int)));

   std::deque<int> deq_int;

   ...fill deq_int...

   f(
      make_some_iterator(deq_int.begin()),
      make_some_iterator(deq_int.end()));
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net