|
Boost : |
From: Jeremy Siek (jsiek_at_[hidden])
Date: 2001-07-26 12:12:05
On Thu, 26 Jul 2001 helmut.zeisel_at_[hidden] wrote:
>
> > but this will cause a problem
> if one
> > wants to call this with make_range().
> >
> > sort_heap(make_range(first, last)); // error, binding temporary to a
> > // reference
> >
>
> I tested using VC++ :-(
>
> Do you have any idea how to solve this problem?
> Passing by const reference and a const_cast within the algorithm?
> This would be very ugly :-(
One option might be to provide two versions of the one-arg sort_heap(),
one that takes any container by reference, and the other that is
explicitly overloaded for the range class.
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>
Cheers,
Jeremy
----------------------------------------------------------------------
Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
Ph.D. Candidate, IU B'ton email: jsiek_at_[hidden]
Summer Manager, AT&T Research phone: (973) 360-8185
----------------------------------------------------------------------
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk