// Vector implementation -*- C++ -*-
-// Copyright (C) 2001-2022 Free Software Foundation, Inc.
+// Copyright (C) 2001-2024 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
#endif
#if __cplusplus >= 202002L
# include <compare>
-#define __cpp_lib_constexpr_vector 201907L
#endif
#include <debug/assertions.h>
}
protected:
+
_GLIBCXX20_CONSTEXPR
void
_M_create_storage(size_t __n)
* individual elements in any order.
*
* @ingroup sequences
+ * @headerfile vector
+ * @since C++98
*
* @tparam _Tp Type of element.
* @tparam _Alloc Allocator type, defaults to allocator<_Tp>.
_GLIBCXX20_CONSTEXPR
void
assign(_InputIterator __first, _InputIterator __last)
- { _M_assign_dispatch(__first, __last, __false_type()); }
+ { _M_assign_aux(__first, __last, std::__iterator_category(__first)); }
#else
template<typename _InputIterator>
void
_GLIBCXX_NODISCARD _GLIBCXX20_CONSTEXPR
size_type
capacity() const _GLIBCXX_NOEXCEPT
- { return size_type(this->_M_impl._M_end_of_storage
- - this->_M_impl._M_start); }
+ {
+ return size_type(this->_M_impl._M_end_of_storage
+ - this->_M_impl._M_start);
+ }
/**
* Returns true if the %vector is empty. (Thus begin() would
_GLIBCXX_ASAN_ANNOTATE_GREW(1);
}
else
- _M_realloc_insert(end(), __x);
+ _M_realloc_append(__x);
}
#if __cplusplus >= 201103L
_InputIterator __last)
{
difference_type __offset = __position - cbegin();
- _M_insert_dispatch(begin() + __offset,
- __first, __last, __false_type());
+ _M_range_insert(begin() + __offset, __first, __last,
+ std::__iterator_category(__first));
return begin() + __offset;
}
#else
void
_M_realloc_insert(iterator __position, const value_type& __x);
+
+ void
+ _M_realloc_append(const value_type& __x);
#else
// A value_type object constructed with _Alloc_traits::construct()
// and destroyed with _Alloc_traits::destroy().
void
_M_realloc_insert(iterator __position, _Args&&... __args);
+ template<typename... _Args>
+ _GLIBCXX20_CONSTEXPR
+ void
+ _M_realloc_append(_Args&&... __args);
+
// Either move-construct at the end, or forward to _M_insert_aux.
_GLIBCXX20_CONSTEXPR
iterator