libstdc++
GNU C++ library
Loading...
Searching...
No Matches

◆ _M_range_initialize() [1/2]

template<typename _Tp, typename _Alloc>
template<typename _ForwardIterator>
void deque::_M_range_initialize ( _ForwardIterator __first,
_ForwardIterator __last,
std::forward_iterator_tag  )
protected

Fills the deque with whatever is in [first,last).

Parameters
__firstAn input iterator.
__lastAn input iterator.
Returns
Nothing.

If the iterators are actually forward iterators (or better), then the memory layout can be done all at once. Else we move forward using push_back on each value from the iterator.

Definition at line 443 of file deque.tcc.

446 {
449
451 __try
452 {
453 for (__cur_node = this->_M_impl._M_start._M_node;
454 __cur_node < this->_M_impl._M_finish._M_node;
455 ++__cur_node)
456 {
457 if (__n < _S_buffer_size())
458 __builtin_unreachable(); // See PR 100516
459
464 __first = __mid;
465 }
467 this->_M_impl._M_finish._M_first,
469 }
470 __catch(...)
471 {
472 std::_Destroy(this->_M_impl._M_start,
476 }
477 }
#define __catch(X)
constexpr iterator_traits< _InputIterator >::difference_type distance(_InputIterator __first, _InputIterator __last)
A generalization of pointer arithmetic.
::_Deque_iterator< _OTp, _OTp &, _OTp * > __uninitialized_copy_a(::_Deque_iterator< _ITp, _IRef, _IPtr > __first, ::_Deque_iterator< _ITp, _IRef, _IPtr > __last, ::_Deque_iterator< _OTp, _OTp &, _OTp * > __result, allocator< _Tp > &)
Definition deque.tcc:1558
constexpr void advance(_InputIterator &__i, _Distance __n)
A generalization of pointer arithmetic.
constexpr void _Destroy(_ForwardIterator __first, _ForwardIterator __last)
void _M_initialize_map(size_t)
Layout storage.
Definition stl_deque.h:642
_Deque_impl _M_impl
Definition stl_deque.h:616
size_t size_type
Definition stl_deque.h:826
static size_t _S_buffer_size() noexcept
Definition stl_deque.h:831
_Tp_alloc_type & _M_get_Tp_allocator() noexcept
Definition stl_deque.h:571
_Base::_Map_pointer _Map_pointer
Definition stl_deque.h:814
_Base::iterator iterator
Definition stl_deque.h:822
static size_t _S_check_init_len(size_t __n, const allocator_type &__a)
Definition stl_deque.h:1966
A standard container using fixed-size memory allocation and constant-time manipulation of elements at...
Definition stl_deque.h:792

References deque(), __catch, __throw_exception_again, __try, std::__uninitialized_copy_a(), std::_Destroy(), _M_get_Tp_allocator(), _M_impl, _M_initialize_map(), _S_buffer_size(), _S_check_init_len(), std::advance(), and std::distance().

Here is the call graph for this function: