Boost logo

Boost :

From: helmut.zeisel_at_[hidden]
Date: 2001-07-26 09:51:41

--- In boost_at_y..., Jeremy Siek <jsiek_at_r...> wrote:
> The half_open_range class that Dave mentioned is basically the same
> as the below range class.

Great :-)

template<typename Iterator> ::boost::half_open_range<Iterator>
make_range(Iterator begin, Iterator end)
  return range<Iterator>(begin,end);

Using my previously posted sort and copy,
this works :-)

  std::vector<int> v;
  copy(v,std::ostream_iterator<int>(std::cout," "));
  std::cout << "\n";

This, however, doesn't :-(

  int w[]={3,2,4,1};
  static const int n = sizeof(w)/sizeof(int);
  copy(make_range(w,w+n),std::ostream_iterator<int>(std::cout," "));
  std::cout << "\n";
  copy(v,std::ostream_iterator<int>(std::cout," "));

Just from a pragmatic point of view:
shouldn't make_range also work with built-in pointers?
Then also the existing STL algorithms can be
uniquely extended to an interface
that accepts a container or a make_range-result.


Boost list run by bdawes at, gregod at, cpdaniel at, john at