// Temporary buffer implementation -*- C++ -*-
-// Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-// 2010, 2011
-// Free Software Foundation, Inc.
+// Copyright (C) 2001-2017 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
/**
* @brief Allocates a temporary buffer.
- * @param len The number of objects of type Tp.
+ * @param __len The number of objects of type Tp.
* @return See full description.
*
* Reinventing the wheel, but this time with prettier spokes!
*
- * This function tries to obtain storage for @c len adjacent Tp
+ * This function tries to obtain storage for @c __len adjacent Tp
* objects. The objects themselves are not constructed, of course.
* A pair<> is returned containing <em>the buffer s address and
- * capacity (in the units of sizeof(Tp)), or a pair of 0 values if
+ * capacity (in the units of sizeof(_Tp)), or a pair of 0 values if
* no storage can be obtained.</em> Note that the capacity obtained
* may be less than that requested if the memory is unavailable;
* you should compare len with the .second return value.
/**
* @brief The companion to get_temporary_buffer().
- * @param p A buffer previously allocated by get_temporary_buffer.
+ * @param __p A buffer previously allocated by get_temporary_buffer.
* @return None.
*
- * Frees the memory pointed to by p.
+ * Frees the memory pointed to by __p.
*/
template<typename _Tp>
inline void
template<bool>
struct __uninitialized_construct_buf_dispatch
{
- template<typename _ForwardIterator, typename _Tp>
+ template<typename _Pointer, typename _ForwardIterator>
static void
- __ucr(_ForwardIterator __first, _ForwardIterator __last,
- _Tp& __value)
+ __ucr(_Pointer __first, _Pointer __last,
+ _ForwardIterator __seed)
{
if(__first == __last)
return;
- _ForwardIterator __cur = __first;
+ _Pointer __cur = __first;
__try
{
std::_Construct(std::__addressof(*__first),
- _GLIBCXX_MOVE(__value));
- _ForwardIterator __prev = __cur;
+ _GLIBCXX_MOVE(*__seed));
+ _Pointer __prev = __cur;
++__cur;
for(; __cur != __last; ++__cur, ++__prev)
std::_Construct(std::__addressof(*__cur),
_GLIBCXX_MOVE(*__prev));
- __value = _GLIBCXX_MOVE(*__prev);
+ *__seed = _GLIBCXX_MOVE(*__prev);
}
__catch(...)
{
template<>
struct __uninitialized_construct_buf_dispatch<true>
{
- template<typename _ForwardIterator, typename _Tp>
+ template<typename _Pointer, typename _ForwardIterator>
static void
- __ucr(_ForwardIterator, _ForwardIterator, _Tp&) { }
+ __ucr(_Pointer, _Pointer, _ForwardIterator) { }
};
// Constructs objects in the range [first, last).
// their exact value is not defined. In particular they may
// be 'moved from'.
//
- // While __value may altered during this algorithm, it will have
+ // While *__seed may be altered during this algorithm, it will have
// the same value when the algorithm finishes, unless one of the
// constructions throws.
//
- // Requirements: _ForwardIterator::value_type(_Tp&&) is valid.
- template<typename _ForwardIterator, typename _Tp>
+ // Requirements: _Pointer::value_type(_Tp&&) is valid.
+ template<typename _Pointer, typename _ForwardIterator>
inline void
- __uninitialized_construct_buf(_ForwardIterator __first,
- _ForwardIterator __last,
- _Tp& __value)
+ __uninitialized_construct_buf(_Pointer __first, _Pointer __last,
+ _ForwardIterator __seed)
{
- typedef typename std::iterator_traits<_ForwardIterator>::value_type
+ typedef typename std::iterator_traits<_Pointer>::value_type
_ValueType;
std::__uninitialized_construct_buf_dispatch<
__has_trivial_constructor(_ValueType)>::
- __ucr(__first, __last, __value);
+ __ucr(__first, __last, __seed);
}
template<typename _ForwardIterator, typename _Tp>
value_type>(_M_original_len));
_M_buffer = __p.first;
_M_len = __p.second;
- if(_M_buffer)
+ if (_M_buffer)
std::__uninitialized_construct_buf(_M_buffer, _M_buffer + _M_len,
- *__first);
+ __first);
}
__catch(...)
{