On 2011.12.03 at 15:35 +0000, Jonathan Wakely wrote:
> On 12 November 2011 15:14, Jonathan Wakely wrote:
> > On 12 November 2011 15:04, Marc Glisse wrote:
> >>
> >> Debug-mode seems to check that first,last is a valid range, is a heap, but
> >> not that it is not empty. Maybe it could?
> >
> > Good idea, thanks.  I'll change that.
> 
> As promised.
> 
>         * include/debug/macros.h (__glibcxx_check_non_empty_range): Define.
>         * include/debug/debug.h (__glibcxx_requires_non_empty_range): Define.
>         * include/debug/formatter.h (__msg_non_empty_range): Add.
>         * src/debug.cc: Message text for __msg_non_empty_range.
>         * include/bits/stl_heap.h (pop_heap): Check for non-empty range.
>         * testsuite/25_algorithms/pop_heap/empty_neg.cc: New.
> 
> Tested x86_64-linux, committed to trunk.

Thanks Jonathan.

You forgot to change the second one with the comparison functor.

diff --git a/libstdc++-v3/include/bits/stl_heap.h 
b/libstdc++-v3/include/bits/stl_heap.h
index ed7750c..af62525 100644
--- a/libstdc++-v3/include/bits/stl_heap.h
+++ b/libstdc++-v3/include/bits/stl_heap.h
@@ -360,6 +360,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
       // concept requirements
       __glibcxx_function_requires(_Mutable_RandomAccessIteratorConcept<
            _RandomAccessIterator>)
+      __glibcxx_requires_non_empty_range(__first, __last);
       __glibcxx_requires_valid_range(__first, __last);
       __glibcxx_requires_heap_pred(__first, __last, __comp);
 

-- 
Markus

Reply via email to