Boost logo

Boost :

From: Gary Powell (Gary.Powell_at_[hidden])
Date: 2001-07-26 12:31:34


[Jeremy Siek]
Another issue is that I'd like to be able to use these kinds of functions
with the graph library. The graph library uses functions that return pairs
of iterators. I want to be able to write this:

find_if(edges(g), is_residual_edge());

// edges() returns pair<edge_iterator,edge_iterator>

[Gary Powell]
  What if you had a make_range which took a std::pair?

template<typename Iterator>
range<Iterator> make_range(std::pair<Iterator, Iterator> const &rhs)
{
   return range<Iterator>(rhs.first, rhs.second);
}

then at least you write.
find_if (make_range(edges(g)), is_residual_edge() );

  Yours,
 -gary-

gary.powell_at_[hidden]

 


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk