# define _GLIBCXX_EXTERN_TEMPLATE -1
#endif
-
-#if _GLIBCXX_HAVE_IS_CONSTANT_EVALUATED
-# define __glibcxx_constexpr_assert(cond) \
- if (std::__is_constant_evaluated() && !bool(cond)) \
- __builtin_unreachable() /* precondition violation detected! */
-#else
-# define __glibcxx_constexpr_assert(unevaluated)
-#endif
-
#undef _GLIBCXX_VERBOSE_ASSERT
// Assert.
{ return __it; }
template<typename _Ite, typename _Seq>
+ _GLIBCXX20_CONSTEXPR
_Ite
__niter_base(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq,
std::random_access_iterator_tag>&);
template<bool _IsMove,
typename _Ite, typename _Seq, typename _Cat, typename _OI>
+ _GLIBCXX20_CONSTEXPR
_OI
__copy_move_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&,
const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&,
template<bool _IsMove,
typename _II, typename _Ite, typename _Seq, typename _Cat>
+ _GLIBCXX20_CONSTEXPR
__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>
__copy_move_a(_II, _II,
const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&);
template<bool _IsMove,
typename _IIte, typename _ISeq, typename _ICat,
typename _OIte, typename _OSeq, typename _OCat>
+ _GLIBCXX20_CONSTEXPR
::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>
__copy_move_a(const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>&,
const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>&,
template<bool _IsMove,
typename _Ite, typename _Seq, typename _Cat, typename _OI>
+ _GLIBCXX20_CONSTEXPR
_OI
__copy_move_backward_a(
const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&,
template<bool _IsMove,
typename _II, typename _Ite, typename _Seq, typename _Cat>
+ _GLIBCXX20_CONSTEXPR
__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>
__copy_move_backward_a(_II, _II,
const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&);
template<bool _IsMove,
typename _IIte, typename _ISeq, typename _ICat,
typename _OIte, typename _OSeq, typename _OCat>
+ _GLIBCXX20_CONSTEXPR
::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>
__copy_move_backward_a(
const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>&,
{ std::__fill_a1(__first, __last, __value); }
template<typename _Ite, typename _Seq, typename _Cat, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
__fill_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&,
const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>&,
template<typename _Ite, typename _Seq, typename _Cat, typename _Size,
typename _Tp>
+ _GLIBCXX20_CONSTEXPR
::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>
__fill_n_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first,
_Size __n, const _Tp& __value,
}
template<typename _II1, typename _Seq1, typename _Cat1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
bool
__equal_aux(const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>&,
const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>&,
_II2);
template<typename _II1, typename _II2, typename _Seq2, typename _Cat2>
+ _GLIBCXX20_CONSTEXPR
bool
__equal_aux(_II1, _II1,
const ::__gnu_debug::_Safe_iterator<_II2, _Seq2, _Cat2>&);
template<typename _II1, typename _Seq1, typename _Cat1,
typename _II2, typename _Seq2, typename _Cat2>
+ _GLIBCXX20_CONSTEXPR
bool
__equal_aux(const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>&,
const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>&,
template<typename _Iter1, typename _Seq1, typename _Cat1,
typename _II2>
+ _GLIBCXX20_CONSTEXPR
bool
__lexicographical_compare_aux(
const ::__gnu_debug::_Safe_iterator<_Iter1, _Seq1, _Cat1>&,
template<typename _II1,
typename _Iter2, typename _Seq2, typename _Cat2>
+ _GLIBCXX20_CONSTEXPR
bool
__lexicographical_compare_aux(
_II1, _II1,
template<typename _Iter1, typename _Seq1, typename _Cat1,
typename _Iter2, typename _Seq2, typename _Cat2>
+ _GLIBCXX20_CONSTEXPR
bool
__lexicographical_compare_aux(
const ::__gnu_debug::_Safe_iterator<_Iter1, _Seq1, _Cat1>&,
/* Remove debug mode safe iterator layer, if any. */
template<typename _Iterator>
+ _GLIBCXX_CONSTEXPR
inline _Iterator
__unsafe(_Iterator __it)
{ return __it; }
* the user error and where the error is reported.
*
*/
-#define _GLIBCXX_DEBUG_VERIFY_COND_AT(_Cond,_ErrMsg,_File,_Line,_Func) \
- if (__builtin_expect(!bool(_Cond), false)) \
- __gnu_debug::_Error_formatter::_S_at(_File, _Line, _Func) \
- ._ErrMsg._M_error()
#define _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond,_ErrMsg,_File,_Line,_Func) \
do { \
- __glibcxx_constexpr_assert(_Cond); \
- _GLIBCXX_DEBUG_VERIFY_COND_AT(_Cond,_ErrMsg,_File,_Line,_Func); \
+ if (__builtin_expect(!bool(_Cond), false)) \
+ __gnu_debug::_Error_formatter::_S_at(_File, _Line, _Func) \
+ ._ErrMsg._M_error(); \
} while (false)
#define _GLIBCXX_DEBUG_VERIFY_AT(_Cond,_ErrMsg,_File,_Line) \
protected:
/** Initializes the iterator and makes it singular. */
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator_base()
: _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)
{ }
* singular. Otherwise, the iterator will reference @p __seq and
* be nonsingular.
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator_base(const _Safe_sequence_base* __seq, bool __constant)
: _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)
- { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); }
+ {
+ if (!std::__is_constant_evaluated())
+ this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant);
+ }
/** Initializes the iterator to reference the same sequence that
@p __x does. @p __constant is true if this is a constant
iterator, and false if it is mutable. */
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator_base(const _Safe_iterator_base& __x, bool __constant)
: _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0)
- { this->_M_attach(__x._M_sequence, __constant); }
+ {
+ if (!std::__is_constant_evaluated())
+ this->_M_attach(__x._M_sequence, __constant);
+ }
- ~_Safe_iterator_base() { this->_M_detach(); }
+ _GLIBCXX20_CONSTEXPR
+ ~_Safe_iterator_base()
+ {
+ if (!std::__is_constant_evaluated())
+ this->_M_detach();
+ }
/** For use in _Safe_iterator. */
__gnu_cxx::__mutex&
protected:
// Initialize with a version number of 1 and no iterators
+ _GLIBCXX20_CONSTEXPR
_Safe_sequence_base() _GLIBCXX_NOEXCEPT
: _M_iterators(0), _M_const_iterators(0), _M_version(1)
{ }
#if __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR
_Safe_sequence_base(const _Safe_sequence_base&) noexcept
: _Safe_sequence_base() { }
// Move constructor swap iterators.
+ _GLIBCXX20_CONSTEXPR
_Safe_sequence_base(_Safe_sequence_base&& __seq) noexcept
: _Safe_sequence_base()
- { _M_swap(__seq); }
+ {
+ if (!std::__is_constant_evaluated())
+ _M_swap(__seq);
+ }
#endif
/** Notify all iterators that reference this sequence that the
sequence is being destroyed. */
+ _GLIBCXX20_CONSTEXPR
~_Safe_sequence_base()
- { this->_M_detach_all(); }
+ {
+ if (!std::__is_constant_evaluated())
+ this->_M_detach_all();
+ }
/** Detach all iterators, leaving them singular. */
void
* operation is complete all iterators that originally referenced
* one container now reference the other container.
*/
+ _GLIBCXX20_CONSTEXPR
void
_M_swap(_Safe_sequence_base& __x) _GLIBCXX_USE_NOEXCEPT;
{
typedef _SafeBase<_SafeContainer> _Base;
+ _GLIBCXX20_CONSTEXPR
_SafeContainer&
_M_cont() _GLIBCXX_NOEXCEPT
{ return *static_cast<_SafeContainer*>(this); }
_Safe_container(_Safe_container&&) = default;
private:
+ _GLIBCXX20_CONSTEXPR
_Safe_container(_Safe_container&& __x, const _Alloc&, std::true_type)
: _Safe_container(std::move(__x))
{ }
+ _GLIBCXX20_CONSTEXPR
_Safe_container(_Safe_container&& __x, const _Alloc& __a, std::false_type)
: _Safe_container()
{
if (__x._M_cont().get_allocator() == __a)
_Base::_M_swap(__x);
- else
+ else if (!std::__is_constant_evaluated())
__x._M_invalidate_all();
}
protected:
+ _GLIBCXX20_CONSTEXPR
_Safe_container(_Safe_container&& __x, const _Alloc& __a)
: _Safe_container(std::move(__x), __a,
typename std::allocator_traits<_Alloc>::is_always_equal{})
#endif
// Copy assignment invalidate all iterators.
+ _GLIBCXX20_CONSTEXPR
_Safe_container&
operator=(const _Safe_container&) _GLIBCXX_NOEXCEPT
{
- this->_M_invalidate_all();
+ if (!std::__is_constant_evaluated())
+ this->_M_invalidate_all();
return *this;
}
#if __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR
_Safe_container&
operator=(_Safe_container&& __x) noexcept
{
+ if (std::__is_constant_evaluated())
+ return *this;
+
if (std::__addressof(__x) == this)
{
// Standard containers have a valid but unspecified value after
return *this;
}
+ _GLIBCXX20_CONSTEXPR
void
_M_swap(_Safe_container& __x) noexcept
{
#endif
#define _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, _BadMsgId, _DiffMsgId) \
+ if (!std::__is_constant_evaluated()) { \
_GLIBCXX_DEBUG_VERIFY((!_Lhs._M_singular() && !_Rhs._M_singular()) \
|| (_Lhs._M_value_initialized() \
&& _Rhs._M_value_initialized()), \
_GLIBCXX_DEBUG_VERIFY(_Lhs._M_can_compare(_Rhs), \
_M_message(_DiffMsgId) \
._M_iterator(_Lhs, #_Lhs) \
- ._M_iterator(_Rhs, #_Rhs))
+ ._M_iterator(_Rhs, #_Rhs)); \
+ }
#define _GLIBCXX_DEBUG_VERIFY_EQ_OPERANDS(_Lhs, _Rhs) \
_GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, __msg_iter_compare_bad, \
struct _Unchecked { };
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(const _Safe_iterator& __x, _Unchecked) _GLIBCXX_NOEXCEPT
: _Iter_base(__x.base()), _Safe_base()
- { _M_attach(__x._M_sequence); }
+ {
+ if (!std::__is_constant_evaluated())
+ _M_attach(__x._M_sequence);
+ }
public:
typedef _Iterator iterator_type;
#endif
/// @post the iterator is singular and unattached
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator() _GLIBCXX_NOEXCEPT : _Iter_base() { }
/**
* @pre @p seq is not NULL
* @post this is not singular
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(_Iterator __i, const _Safe_sequence_base* __seq)
_GLIBCXX_NOEXCEPT
: _Iter_base(__i), _Safe_base(__seq, _S_constant())
/**
* @brief Copy construction.
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT
: _Iter_base(__x.base()), _Safe_base()
{
+ if (std::__is_constant_evaluated())
+ return;
+
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 408. Is vector<reverse_iterator<char*> > forbidden?
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
* @brief Move construction.
* @post __x is singular and unattached
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(_Safe_iterator&& __x) noexcept
: _Iter_base()
{
+ if (std::__is_constant_evaluated())
+ {
+ base() = __x.base();
+ return;
+ }
+
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
|| __x._M_value_initialized(),
_M_message(__msg_init_copy_singular)
* constant iterator.
*/
template<typename _MutableIterator>
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(
const _Safe_iterator<_MutableIterator, _Sequence,
typename __gnu_cxx::__enable_if<_IsConstant::__value &&
_GLIBCXX_NOEXCEPT
: _Iter_base(__x.base())
{
+ if (std::__is_constant_evaluated())
+ return;
+
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 408. Is vector<reverse_iterator<char*> > forbidden?
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
/**
* @brief Copy assignment.
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator&
operator=(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT
{
+ if (std::__is_constant_evaluated())
+ {
+ base() = __x.base();
+ return *this;
+ }
+
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// DR 408. Is vector<reverse_iterator<char*> > forbidden?
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
* @brief Move assignment.
* @post __x is singular and unattached
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator&
operator=(_Safe_iterator&& __x) noexcept
{
+ if (std::__is_constant_evaluated())
+ {
+ base() = __x.base();
+ return *this;
+ }
+
_GLIBCXX_DEBUG_VERIFY(!__x._M_singular()
|| __x._M_value_initialized(),
_M_message(__msg_copy_singular)
* @pre iterator is dereferenceable
*/
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
reference
operator*() const _GLIBCXX_NOEXCEPT
{
- _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
- _M_message(__msg_bad_deref)
- ._M_iterator(*this, "this"));
+ if (!std::__is_constant_evaluated())
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
+ _M_message(__msg_bad_deref)
+ ._M_iterator(*this, "this"));
+ }
return *base();
}
* @pre iterator is dereferenceable
*/
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
pointer
operator->() const _GLIBCXX_NOEXCEPT
{
- _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
- _M_message(__msg_bad_deref)
- ._M_iterator(*this, "this"));
+ if (!std::__is_constant_evaluated())
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(),
+ _M_message(__msg_bad_deref)
+ ._M_iterator(*this, "this"));
+ }
return base().operator->();
}
* @brief Iterator preincrement
* @pre iterator is incrementable
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator&
operator++() _GLIBCXX_NOEXCEPT
{
+ if (std::__is_constant_evaluated())
+ {
+ ++base();
+ return *this;
+ }
+
_GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
_M_message(__msg_bad_inc)
._M_iterator(*this, "this"));
* @brief Iterator postincrement
* @pre iterator is incrementable
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator
operator++(int) _GLIBCXX_NOEXCEPT
{
- _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
- _M_message(__msg_bad_inc)
- ._M_iterator(*this, "this"));
+ if (!std::__is_constant_evaluated())
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
+ _M_message(__msg_bad_inc)
+ ._M_iterator(*this, "this"));
+ }
_Safe_iterator __ret(*this, _Unchecked());
++*this;
return __ret;
/**
* @brief Return the underlying iterator
*/
+ _GLIBCXX20_CONSTEXPR
_Iterator&
base() _GLIBCXX_NOEXCEPT { return *this; }
+ _GLIBCXX20_CONSTEXPR
const _Iterator&
base() const _GLIBCXX_NOEXCEPT { return *this; }
* @brief Conversion to underlying non-debug iterator to allow
* better interaction with non-debug containers.
*/
+ _GLIBCXX20_CONSTEXPR
operator _Iterator() const _GLIBCXX_NOEXCEPT { return *this; }
/** Attach iterator to the given sequence. */
_M_get_distance_to_end() const;
/// Is this iterator equal to the sequence's begin() iterator?
+ _GLIBCXX20_CONSTEXPR
bool
_M_is_begin() const
{ return base() == _M_get_sequence()->_M_base().begin(); }
typedef _Safe_iterator<_Iterator, _Sequence, iterator_category> _Self;
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
friend bool
operator==(const _Self& __lhs, const _Self& __rhs) _GLIBCXX_NOEXCEPT
{
template<typename _IteR>
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
friend bool
operator==(const _Self& __lhs,
const _Safe_iterator<_IteR, _Sequence, iterator_category>& __rhs)
typedef typename _Safe_base::_Unchecked _Unchecked;
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(const _Safe_iterator& __x,
_Unchecked __unchecked) _GLIBCXX_NOEXCEPT
: _Safe_base(__x, __unchecked)
public:
/// @post the iterator is singular and unattached
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator() _GLIBCXX_NOEXCEPT { }
/**
* @pre @p seq is not NULL
* @post this is not singular
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(_Iterator __i, const _Safe_sequence_base* __seq)
_GLIBCXX_NOEXCEPT
: _Safe_base(__i, __seq)
/**
* @brief Copy construction.
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT
: _Safe_base(__x)
{ }
#if __cplusplus >= 201103L
/** @brief Move construction. */
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(_Safe_iterator&&) = default;
#endif
* constant iterator.
*/
template<typename _MutableIterator>
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(
const _Safe_iterator<_MutableIterator, _Sequence,
typename __gnu_cxx::__enable_if<_Safe_base::_IsConstant::__value &&
* @brief Iterator preincrement
* @pre iterator is incrementable
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator&
operator++() _GLIBCXX_NOEXCEPT
{
* @brief Iterator predecrement
* @pre iterator is decrementable
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator&
operator--() _GLIBCXX_NOEXCEPT
{
+ if (std::__is_constant_evaluated())
+ {
+ --this->base();
+ return *this;
+ }
+
_GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
_M_message(__msg_bad_dec)
._M_iterator(*this, "this"));
std::random_access_iterator_tag> _OtherSelf;
typedef typename _Safe_base::_Unchecked _Unchecked;
+
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(const _Safe_iterator& __x,
_Unchecked __unchecked) _GLIBCXX_NOEXCEPT
: _Safe_base(__x, __unchecked)
typedef typename _Safe_base::reference reference;
/// @post the iterator is singular and unattached
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator() _GLIBCXX_NOEXCEPT { }
/**
* @pre @p seq is not NULL
* @post this is not singular
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(_Iterator __i, const _Safe_sequence_base* __seq)
_GLIBCXX_NOEXCEPT
: _Safe_base(__i, __seq)
/**
* @brief Copy construction.
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT
: _Safe_base(__x)
{ }
* constant iterator.
*/
template<typename _MutableIterator>
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator(
const _Safe_iterator<_MutableIterator, _Sequence,
typename __gnu_cxx::__enable_if<_Safe_base::_IsConstant::__value &&
* @brief Iterator preincrement
* @pre iterator is incrementable
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator&
operator++() _GLIBCXX_NOEXCEPT
{
* @brief Iterator postincrement
* @pre iterator is incrementable
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator
operator++(int) _GLIBCXX_NOEXCEPT
{
- _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
- _M_message(__msg_bad_inc)
- ._M_iterator(*this, "this"));
+ if (!std::__is_constant_evaluated())
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(),
+ _M_message(__msg_bad_inc)
+ ._M_iterator(*this, "this"));
+ }
_Safe_iterator __ret(*this, _Unchecked());
++*this;
return __ret;
* @brief Iterator predecrement
* @pre iterator is decrementable
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator&
operator--() _GLIBCXX_NOEXCEPT
{
* @brief Iterator postdecrement
* @pre iterator is decrementable
*/
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator
operator--(int) _GLIBCXX_NOEXCEPT
{
- _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
- _M_message(__msg_bad_dec)
- ._M_iterator(*this, "this"));
+ if (!std::__is_constant_evaluated())
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(),
+ _M_message(__msg_bad_dec)
+ ._M_iterator(*this, "this"));
+ }
_Safe_iterator __ret(*this, _Unchecked());
--*this;
return __ret;
// ------ Random access iterator requirements ------
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
reference
operator[](difference_type __n) const _GLIBCXX_NOEXCEPT
{
- _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n)
- && this->_M_can_advance(__n + 1),
- _M_message(__msg_iter_subscript_oob)
- ._M_iterator(*this)._M_integer(__n));
+ if (!std::__is_constant_evaluated())
+ {
+ _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n)
+ && this->_M_can_advance(__n + 1),
+ _M_message(__msg_iter_subscript_oob)
+ ._M_iterator(*this)._M_integer(__n));
+ }
return this->base()[__n];
}
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator&
operator+=(difference_type __n) _GLIBCXX_NOEXCEPT
{
+ if (std::__is_constant_evaluated())
+ {
+ this->base() += __n;
+ return *this;
+ }
+
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n),
_M_message(__msg_advance_oob)
._M_iterator(*this)._M_integer(__n));
return *this;
}
+ _GLIBCXX20_CONSTEXPR
_Safe_iterator&
operator-=(difference_type __n) _GLIBCXX_NOEXCEPT
{
+ if (std::__is_constant_evaluated())
+ {
+ this->base() -= __n;
+ return *this;
+ }
+
_GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n),
_M_message(__msg_retreat_oob)
._M_iterator(*this)._M_integer(__n));
#if __cpp_lib_three_way_comparison
[[nodiscard]]
+ _GLIBCXX20_CONSTEXPR
friend auto
operator<=>(const _Self& __lhs, const _Self& __rhs) noexcept
{
}
[[nodiscard]]
+ _GLIBCXX20_CONSTEXPR
friend auto
operator<=>(const _Self& __lhs, const _OtherSelf& __rhs) noexcept
{
// operators but also operator- must accept mixed iterator/const_iterator
// parameters.
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
friend difference_type
operator-(const _Self& __lhs, const _OtherSelf& __rhs) _GLIBCXX_NOEXCEPT
{
}
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
friend difference_type
operator-(const _Self& __lhs, const _Self& __rhs) _GLIBCXX_NOEXCEPT
{
}
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
friend _Self
operator+(const _Self& __x, difference_type __n) _GLIBCXX_NOEXCEPT
{
- _GLIBCXX_DEBUG_VERIFY(__x._M_can_advance(__n),
- _M_message(__msg_advance_oob)
- ._M_iterator(__x)._M_integer(__n));
+ if (!std::__is_constant_evaluated())
+ {
+ _GLIBCXX_DEBUG_VERIFY(__x._M_can_advance(__n),
+ _M_message(__msg_advance_oob)
+ ._M_iterator(__x)._M_integer(__n));
+ }
return _Safe_iterator(__x.base() + __n, __x._M_sequence);
}
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
friend _Self
operator+(difference_type __n, const _Self& __x) _GLIBCXX_NOEXCEPT
{
- _GLIBCXX_DEBUG_VERIFY(__x._M_can_advance(__n),
- _M_message(__msg_advance_oob)
- ._M_iterator(__x)._M_integer(__n));
+ if (!std::__is_constant_evaluated())
+ {
+ _GLIBCXX_DEBUG_VERIFY(__x._M_can_advance(__n),
+ _M_message(__msg_advance_oob)
+ ._M_iterator(__x)._M_integer(__n));
+ }
return _Safe_iterator(__n + __x.base(), __x._M_sequence);
}
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
friend _Self
operator-(const _Self& __x, difference_type __n) _GLIBCXX_NOEXCEPT
{
- _GLIBCXX_DEBUG_VERIFY(__x._M_can_advance(-__n),
- _M_message(__msg_retreat_oob)
- ._M_iterator(__x)._M_integer(__n));
+ if (!std::__is_constant_evaluated())
+ {
+ _GLIBCXX_DEBUG_VERIFY(__x._M_can_advance(-__n),
+ _M_message(__msg_retreat_oob)
+ ._M_iterator(__x)._M_integer(__n));
+ }
return _Safe_iterator(__x.base() - __n, __x._M_sequence);
}
};
_GLIBCXX_BEGIN_NAMESPACE_VERSION
template<typename _Ite, typename _Seq>
+ _GLIBCXX20_CONSTEXPR
_Ite
__niter_base(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq,
std::random_access_iterator_tag>& __it)
template<bool _IsMove,
typename _Ite, typename _Seq, typename _Cat, typename _OI>
+ _GLIBCXX20_CONSTEXPR
_OI
__copy_move_a(
const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first,
template<bool _IsMove,
typename _II, typename _Ite, typename _Seq, typename _Cat>
+ _GLIBCXX20_CONSTEXPR
__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>
__copy_move_a(_II __first, _II __last,
const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __result)
template<bool _IsMove,
typename _IIte, typename _ISeq, typename _ICat,
typename _OIte, typename _OSeq, typename _OCat>
+ _GLIBCXX20_CONSTEXPR
::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>
__copy_move_a(
const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>& __first,
template<bool _IsMove,
typename _Ite, typename _Seq, typename _Cat, typename _OI>
+ _GLIBCXX20_CONSTEXPR
_OI
__copy_move_backward_a(
const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first,
template<bool _IsMove,
typename _II, typename _Ite, typename _Seq, typename _Cat>
+ _GLIBCXX20_CONSTEXPR
__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>
__copy_move_backward_a(_II __first, _II __last,
const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __result)
template<bool _IsMove,
typename _IIte, typename _ISeq, typename _ICat,
typename _OIte, typename _OSeq, typename _OCat>
+ _GLIBCXX20_CONSTEXPR
::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>
__copy_move_backward_a(
const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>& __first,
}
template<typename _Ite, typename _Seq, typename _Cat, typename _Tp>
+ _GLIBCXX20_CONSTEXPR
void
__fill_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first,
const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __last,
template<typename _Ite, typename _Seq, typename _Cat, typename _Size,
typename _Tp>
+ _GLIBCXX20_CONSTEXPR
::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>
__fill_n_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first,
_Size __n, const _Tp& __value,
}
template<typename _II1, typename _Seq1, typename _Cat1, typename _II2>
+ _GLIBCXX20_CONSTEXPR
bool
__equal_aux(
const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>& __first1,
}
template<typename _II1, typename _II2, typename _Seq2, typename _Cat2>
+ _GLIBCXX20_CONSTEXPR
bool
__equal_aux(_II1 __first1, _II1 __last1,
const ::__gnu_debug::_Safe_iterator<_II2, _Seq2, _Cat2>& __first2)
template<typename _II1, typename _Seq1, typename _Cat1,
typename _II2, typename _Seq2, typename _Cat2>
+ _GLIBCXX20_CONSTEXPR
bool
__equal_aux(
const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>& __first1,
template<typename _Ite1, typename _Seq1, typename _Cat1,
typename _II2>
+ _GLIBCXX20_CONSTEXPR
bool
__lexicographical_compare_aux(
const ::__gnu_debug::_Safe_iterator<_Ite1, _Seq1, _Cat1>& __first1,
template<typename _II1,
typename _Ite2, typename _Seq2, typename _Cat2>
+ _GLIBCXX20_CONSTEXPR
bool
__lexicographical_compare_aux(
_II1 __first1, _II1 __last1,
template<typename _Ite1, typename _Seq1, typename _Cat1,
typename _Ite2, typename _Seq2, typename _Cat2>
+ _GLIBCXX20_CONSTEXPR
bool
__lexicographical_compare_aux(
const ::__gnu_debug::_Safe_iterator<_Ite1, _Seq1, _Cat1>& __first1,
{
typedef typename _BaseSequence::size_type size_type;
+ _GLIBCXX20_CONSTEXPR
const _SafeSequence&
_M_seq() const { return *static_cast<const _SafeSequence*>(this); }
protected:
+ _GLIBCXX20_CONSTEXPR
_Safe_vector() _GLIBCXX_NOEXCEPT
: _M_guaranteed_capacity(0)
{ _M_update_guaranteed_capacity(); }
+ _GLIBCXX20_CONSTEXPR
_Safe_vector(const _Safe_vector&) _GLIBCXX_NOEXCEPT
: _M_guaranteed_capacity(0)
{ _M_update_guaranteed_capacity(); }
+ _GLIBCXX20_CONSTEXPR
_Safe_vector(size_type __n) _GLIBCXX_NOEXCEPT
: _M_guaranteed_capacity(__n)
{ }
+ _GLIBCXX20_CONSTEXPR
_Safe_vector&
operator=(const _Safe_vector&) _GLIBCXX_NOEXCEPT
{
}
#if __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR
_Safe_vector(_Safe_vector&& __x) noexcept
: _Safe_vector()
{ __x._M_guaranteed_capacity = 0; }
+ _GLIBCXX20_CONSTEXPR
_Safe_vector&
operator=(_Safe_vector&& __x) noexcept
{
_M_requires_reallocation(size_type __elements) const _GLIBCXX_NOEXCEPT
{ return __elements > _M_seq().capacity(); }
+ _GLIBCXX20_CONSTEXPR
void
_M_update_guaranteed_capacity() _GLIBCXX_NOEXCEPT
{
vector() = default;
#endif
+ _GLIBCXX20_CONSTEXPR
explicit
vector(const _Allocator& __a) _GLIBCXX_NOEXCEPT
: _Base(__a) { }
#if __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR
explicit
vector(size_type __n, const _Allocator& __a = _Allocator())
: _Base(__n, __a), _Safe_vector(__n) { }
+ _GLIBCXX20_CONSTEXPR
vector(size_type __n, const __type_identity_t<_Tp>& __value,
const _Allocator& __a = _Allocator())
: _Base(__n, __value, __a) { }
#else
template<class _InputIterator>
#endif
+ _GLIBCXX20_CONSTEXPR
vector(_InputIterator __first, _InputIterator __last,
const _Allocator& __a = _Allocator())
- : _Base(__gnu_debug::__base(
- __glibcxx_check_valid_constructor_range(__first, __last)),
+ : _Base(__gnu_debug::__base(std::__is_constant_evaluated() ? __first
+ : __glibcxx_check_valid_constructor_range(__first, __last)),
__gnu_debug::__base(__last), __a) { }
#if __cplusplus < 201103L
vector(const vector&) = default;
vector(vector&&) = default;
+ _GLIBCXX20_CONSTEXPR
vector(const vector& __x, const __type_identity_t<allocator_type>& __a)
: _Base(__x, __a) { }
+ _GLIBCXX20_CONSTEXPR
vector(vector&& __x, const __type_identity_t<allocator_type>& __a)
noexcept(
std::is_nothrow_constructible<_Base,
_Base(std::move(__x), __a),
_Safe_vector(std::move(__x)) { }
+ _GLIBCXX20_CONSTEXPR
vector(initializer_list<value_type> __l,
const allocator_type& __a = allocator_type())
: _Base(__l, __a) { }
#endif
/// Construction from a normal-mode vector
+ _GLIBCXX20_CONSTEXPR
vector(_Base_ref __x)
: _Base(__x._M_ref) { }
vector&
operator=(vector&&) = default;
+ _GLIBCXX20_CONSTEXPR
vector&
operator=(initializer_list<value_type> __l)
{
_Base::operator=(__l);
- this->_M_invalidate_all();
- this->_M_update_guaranteed_capacity();
+ if (!std::__is_constant_evaluated())
+ {
+ this->_M_invalidate_all();
+ this->_M_update_guaranteed_capacity();
+ }
return *this;
}
#endif
#else
template<typename _InputIterator>
#endif
+ _GLIBCXX20_CONSTEXPR
void
assign(_InputIterator __first, _InputIterator __last)
{
+ if (std::__is_constant_evaluated())
+ return _Base::assign(__gnu_debug::__unsafe(__first),
+ __gnu_debug::__unsafe(__last));
+
typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
__glibcxx_check_valid_range2(__first, __last, __dist);
this->_M_update_guaranteed_capacity();
}
+ _GLIBCXX20_CONSTEXPR
void
assign(size_type __n, const _Tp& __u)
{
_Base::assign(__n, __u);
- this->_M_invalidate_all();
- this->_M_update_guaranteed_capacity();
+ if (!std::__is_constant_evaluated())
+ {
+ this->_M_invalidate_all();
+ this->_M_update_guaranteed_capacity();
+ }
}
#if __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR
void
assign(initializer_list<value_type> __l)
{
_Base::assign(__l);
- this->_M_invalidate_all();
- this->_M_update_guaranteed_capacity();
+ if (!std::__is_constant_evaluated())
+ {
+ this->_M_invalidate_all();
+ this->_M_update_guaranteed_capacity();
+ }
}
#endif
// iterators:
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
iterator
begin() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::begin(), this); }
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
const_iterator
begin() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::begin(), this); }
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
iterator
end() _GLIBCXX_NOEXCEPT
{ return iterator(_Base::end(), this); }
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
const_iterator
end() const _GLIBCXX_NOEXCEPT
{ return const_iterator(_Base::end(), this); }
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
reverse_iterator
rbegin() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(end()); }
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
const_reverse_iterator
rbegin() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(end()); }
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
reverse_iterator
rend() _GLIBCXX_NOEXCEPT
{ return reverse_iterator(begin()); }
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
const_reverse_iterator
rend() const _GLIBCXX_NOEXCEPT
{ return const_reverse_iterator(begin()); }
#if __cplusplus >= 201103L
[[__nodiscard__]]
+ _GLIBCXX20_CONSTEXPR
const_iterator
cbegin() const noexcept
{ return const_iterator(_Base::begin(), this); }
[[__nodiscard__]]
+ _GLIBCXX20_CONSTEXPR
const_iterator
cend() const noexcept
{ return const_iterator(_Base::end(), this); }
[[__nodiscard__]]
+ _GLIBCXX20_CONSTEXPR
const_reverse_iterator
crbegin() const noexcept
{ return const_reverse_iterator(end()); }
[[__nodiscard__]]
+ _GLIBCXX20_CONSTEXPR
const_reverse_iterator
crend() const noexcept
{ return const_reverse_iterator(begin()); }
using _Base::max_size;
#if __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR
void
resize(size_type __sz)
{
+ if (std::__is_constant_evaluated())
+ return _Base::resize(__sz);
+
bool __realloc = this->_M_requires_reallocation(__sz);
if (__sz < this->size())
this->_M_invalidate_after_nth(__sz);
this->_M_update_guaranteed_capacity();
}
+ _GLIBCXX20_CONSTEXPR
void
resize(size_type __sz, const _Tp& __c)
{
+ if (std::__is_constant_evaluated())
+ return _Base::resize(__sz, __c);
+
bool __realloc = this->_M_requires_reallocation(__sz);
if (__sz < this->size())
this->_M_invalidate_after_nth(__sz);
#endif
#if __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR
void
shrink_to_fit()
{
+ if (std::__is_constant_evaluated())
+ return _Base::shrink_to_fit();
+
if (_Base::_M_shrink_to_fit())
{
this->_M_guaranteed_capacity = _Base::capacity();
#endif
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
size_type
capacity() const _GLIBCXX_NOEXCEPT
{
+ if (std::__is_constant_evaluated())
+ return _Base::capacity();
+
#ifdef _GLIBCXX_DEBUG_PEDANTIC
return this->_M_guaranteed_capacity;
#else
using _Base::empty;
+ _GLIBCXX20_CONSTEXPR
void
reserve(size_type __n)
{
+ if (std::__is_constant_evaluated())
+ return _Base::reserve(__n);
+
bool __realloc = this->_M_requires_reallocation(__n);
_Base::reserve(__n);
if (__n > this->_M_guaranteed_capacity)
// element access:
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
reference
operator[](size_type __n) _GLIBCXX_NOEXCEPT
{
}
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
const_reference
operator[](size_type __n) const _GLIBCXX_NOEXCEPT
{
using _Base::at;
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
reference
front() _GLIBCXX_NOEXCEPT
{
}
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
const_reference
front() const _GLIBCXX_NOEXCEPT
{
}
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
reference
back() _GLIBCXX_NOEXCEPT
{
}
_GLIBCXX_NODISCARD
+ _GLIBCXX20_CONSTEXPR
const_reference
back() const _GLIBCXX_NOEXCEPT
{
using _Base::data;
// 23.2.4.3 modifiers:
+ _GLIBCXX20_CONSTEXPR
void
push_back(const _Tp& __x)
{
+ if (std::__is_constant_evaluated())
+ return _Base::push_back(__x);
+
bool __realloc = this->_M_requires_reallocation(this->size() + 1);
_Base::push_back(__x);
if (__realloc)
#if __cplusplus >= 201103L
template<typename _Up = _Tp>
+ _GLIBCXX20_CONSTEXPR
typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value,
void>::__type
push_back(_Tp&& __x)
{ emplace_back(std::move(__x)); }
template<typename... _Args>
+ _GLIBCXX20_CONSTEXPR
#if __cplusplus > 201402L
reference
#else
#endif
emplace_back(_Args&&... __args)
{
+ if (std::__is_constant_evaluated())
+ return _Base::emplace_back(std::forward<_Args>(__args)...);
+
bool __realloc = this->_M_requires_reallocation(this->size() + 1);
_Base::emplace_back(std::forward<_Args>(__args)...);
if (__realloc)
}
#endif
+ _GLIBCXX20_CONSTEXPR
void
pop_back() _GLIBCXX_NOEXCEPT
{
- __glibcxx_check_nonempty();
- this->_M_invalidate_if(_Equal(--_Base::end()));
+ if (!std::__is_constant_evaluated())
+ {
+ __glibcxx_check_nonempty();
+ this->_M_invalidate_if(_Equal(--_Base::end()));
+ }
_Base::pop_back();
}
#if __cplusplus >= 201103L
template<typename... _Args>
+ _GLIBCXX20_CONSTEXPR
iterator
emplace(const_iterator __position, _Args&&... __args)
{
+ if (std::__is_constant_evaluated())
+ return iterator(_Base::emplace(__position.base(),
+ std::forward<_Args>(__args)...),
+ this);
+
__glibcxx_check_insert(__position);
bool __realloc = this->_M_requires_reallocation(this->size() + 1);
difference_type __offset = __position.base() - _Base::cbegin();
}
#endif
+ _GLIBCXX20_CONSTEXPR
iterator
#if __cplusplus >= 201103L
insert(const_iterator __position, const _Tp& __x)
insert(iterator __position, const _Tp& __x)
#endif
{
+ if (std::__is_constant_evaluated())
+ return iterator(_Base::insert(__position.base(), __x), this);
+
__glibcxx_check_insert(__position);
bool __realloc = this->_M_requires_reallocation(this->size() + 1);
difference_type __offset = __position.base() - _Base::begin();
#if __cplusplus >= 201103L
template<typename _Up = _Tp>
+ _GLIBCXX20_CONSTEXPR
typename __gnu_cxx::__enable_if<!std::__are_same<_Up, bool>::__value,
iterator>::__type
insert(const_iterator __position, _Tp&& __x)
{ return emplace(__position, std::move(__x)); }
+ _GLIBCXX20_CONSTEXPR
iterator
insert(const_iterator __position, initializer_list<value_type> __l)
{ return this->insert(__position, __l.begin(), __l.end()); }
#endif
#if __cplusplus >= 201103L
+ _GLIBCXX20_CONSTEXPR
iterator
insert(const_iterator __position, size_type __n, const _Tp& __x)
{
+ if (std::__is_constant_evaluated())
+ return iterator(_Base::insert(__position.base(), __n, __x), this);
+
__glibcxx_check_insert(__position);
bool __realloc = this->_M_requires_reallocation(this->size() + __n);
difference_type __offset = __position.base() - _Base::cbegin();
#if __cplusplus >= 201103L
template<class _InputIterator,
typename = std::_RequireInputIter<_InputIterator>>
+ _GLIBCXX20_CONSTEXPR
iterator
insert(const_iterator __position,
_InputIterator __first, _InputIterator __last)
{
+ if (std::__is_constant_evaluated())
+ return iterator(_Base::insert(__position.base(),
+ __gnu_debug::__unsafe(__first),
+ __gnu_debug::__unsafe(__last)), this);
+
typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist;
__glibcxx_check_insert_range(__position, __first, __last, __dist);
}
#endif
+ _GLIBCXX20_CONSTEXPR
iterator
#if __cplusplus >= 201103L
erase(const_iterator __position)
erase(iterator __position)
#endif
{
+ if (std::__is_constant_evaluated())
+ return iterator(_Base::erase(__position.base()), this);
+
__glibcxx_check_erase(__position);
difference_type __offset = __position.base() - _Base::begin();
_Base_iterator __res = _Base::erase(__position.base());
return iterator(__res, this);
}
+ _GLIBCXX20_CONSTEXPR
iterator
#if __cplusplus >= 201103L
erase(const_iterator __first, const_iterator __last)
erase(iterator __first, iterator __last)
#endif
{
+ if (std::__is_constant_evaluated())
+ return iterator(_Base::erase(__first.base(), __last.base()), this);
+
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 151. can't currently clear() empty container
__glibcxx_check_erase_range(__first, __last);
#endif
}
+ _GLIBCXX20_CONSTEXPR
void
swap(vector& __x)
_GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) )
{
- _Safe::_M_swap(__x);
+ if (!std::__is_constant_evaluated())
+ _Safe::_M_swap(__x);
_Base::swap(__x);
std::swap(this->_M_guaranteed_capacity, __x._M_guaranteed_capacity);
}
+ _GLIBCXX20_CONSTEXPR
void
clear() _GLIBCXX_NOEXCEPT
{
_Base::clear();
- this->_M_invalidate_all();
+ if (!std::__is_constant_evaluated())
+ this->_M_invalidate_all();
}
+ _GLIBCXX20_CONSTEXPR
_Base&
_M_base() _GLIBCXX_NOEXCEPT { return *this; }
+ _GLIBCXX20_CONSTEXPR
const _Base&
_M_base() const _GLIBCXX_NOEXCEPT { return *this; }
};
template<typename _Tp, typename _Alloc>
+ _GLIBCXX20_CONSTEXPR
inline bool
operator==(const vector<_Tp, _Alloc>& __lhs,
const vector<_Tp, _Alloc>& __rhs)
#endif // three-way comparison
template<typename _Tp, typename _Alloc>
+ _GLIBCXX20_CONSTEXPR
inline void
swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs)
_GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs)))
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// <http://www.gnu.org/licenses/>.
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++23 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <utility>
static_assert(test_member_swap());
+#ifndef _GLIBCXX_DEBUG
constexpr bool
test_reference_swap()
{
}
static_assert(test_reference_swap());
+#endif
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// <http://www.gnu.org/licenses/>.
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++20 } }
// { dg-add-options no_pch }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
// { dg-error "value type is destructible" "" { target *-*-* } 0 }
// In Debug Mode the "required from here" errors come from <debug/vector>
-// { dg-error "required from here" "" { target *-*-* } 172 }
+// { dg-error "required from here" "" { target *-*-* } 180 }
// Needed because of PR c++/92193
// { dg-prune-output "deleted function" }
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <testsuite_hooks.h>
// { dg-do compile { target c++20 } }
-// { dg-xfail-if "not supported" { debug_mode } }
#include <vector>
#include <utility>