Boost logo

Boost :

From: Ed Brey (edbrey_at_[hidden])
Date: 2001-07-26 11:02:49


From: "Jeremy Siek" <jsiek_at_[hidden]>
>
> template <class Range>
> void sort_heap(Range& range)
> {
> std::sort_heap(range.begin(), range.end());
> }
>
> BTW, there's one problem with the above. To efficiently pass in a
> container we need pass-by-reference, 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

When will the reference ever need to be non-const? All the underlying
algorithms take iterators by value, and hence leave them untouched.


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