+2018-06-05 François Dumont <fdumont@gcc.gnu.org>
+
+ * include/bits/stl_tempbuf.h
+ (_Temporary_buffer(_FwdIte, _FwdIte)): Delete, replaced by...
+ (_Temporary_buffer(_FwdIte, size_type)): ...this, new.
+ * include/ext/memory (temporary_buffer<>(_FwdIte, _FwdIte)): Adapt.
+ * include/bits/stl_algo.h (__stable_partition): Adapt.
+ (__inplace_merge): Adapt.
+ (__stable_sort): Adapt.
+
2018-06-04 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/85930
typedef typename iterator_traits<_ForwardIterator>::difference_type
_DistanceType;
- _Temporary_buffer<_ForwardIterator, _ValueType> __buf(__first, __last);
+ _Temporary_buffer<_ForwardIterator, _ValueType>
+ __buf(__first, std::distance(__first, __last));
return
std::__stable_partition_adaptive(__first, __last, __pred,
_DistanceType(__buf.requested_size()),
const _DistanceType __len2 = std::distance(__middle, __last);
typedef _Temporary_buffer<_BidirectionalIterator, _ValueType> _TmpBuf;
- _TmpBuf __buf(__first, __last);
+ _TmpBuf __buf(__first, __len1 + __len2);
if (__buf.begin() == 0)
std::__merge_without_buffer
_DistanceType;
typedef _Temporary_buffer<_RandomAccessIterator, _ValueType> _TmpBuf;
- _TmpBuf __buf(__first, __last);
+ _TmpBuf __buf(__first, std::distance(__first, __last));
if (__buf.begin() == 0)
std::__inplace_stable_sort(__first, __last, __comp);
/**
* Constructs a temporary buffer of a size somewhere between
- * zero and the size of the given range.
+ * zero and the given length.
*/
- _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last);
+ _Temporary_buffer(_ForwardIterator __seed, size_type __original_len);
~_Temporary_buffer()
{
template<typename _ForwardIterator, typename _Tp>
_Temporary_buffer<_ForwardIterator, _Tp>::
- _Temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
- : _M_original_len(std::distance(__first, __last)),
- _M_len(0), _M_buffer(0)
+ _Temporary_buffer(_ForwardIterator __seed, size_type __original_len)
+ : _M_original_len(__original_len), _M_len(0), _M_buffer(0)
{
__try
{
_M_len = __p.second;
if (_M_buffer)
std::__uninitialized_construct_buf(_M_buffer, _M_buffer + _M_len,
- __first);
+ __seed);
}
__catch(...)
{
} // namespace
#endif /* _STL_TEMPBUF_H */
-
{
/// Requests storage large enough to hold a copy of [first,last).
temporary_buffer(_ForwardIterator __first, _ForwardIterator __last)
- : _Temporary_buffer<_ForwardIterator, _Tp>(__first, __last) { }
+ : _Temporary_buffer<_ForwardIterator, _Tp>(__first,
+ std::distance(__first, __last))
+ { }
/// Destroys objects and frees storage.
~temporary_buffer() { }