From 321d9a24a8e42bfb0378713c06c08619d0c23529 Mon Sep 17 00:00:00 2001 From: ThirteenAG Date: Thu, 10 Oct 2024 00:38:19 +0800 Subject: [PATCH] update .gitignore --- .gitignore | 2 +- .../include/c++/11.2.0/debug/assertions.h | 70 + .../include/c++/11.2.0/debug/bitset | 429 +++++ .../include/c++/11.2.0/debug/debug.h | 137 ++ .../include/c++/11.2.0/debug/deque | 707 ++++++++ .../include/c++/11.2.0/debug/formatter.h | 594 +++++++ .../include/c++/11.2.0/debug/forward_list | 947 +++++++++++ .../include/c++/11.2.0/debug/functions.h | 470 ++++++ .../c++/11.2.0/debug/helper_functions.h | 331 ++++ .../include/c++/11.2.0/debug/list | 987 +++++++++++ .../include/c++/11.2.0/debug/macros.h | 466 ++++++ .../include/c++/11.2.0/debug/map | 46 + .../include/c++/11.2.0/debug/map.h | 807 +++++++++ .../include/c++/11.2.0/debug/multimap.h | 688 ++++++++ .../include/c++/11.2.0/debug/multiset.h | 653 ++++++++ .../include/c++/11.2.0/debug/safe_base.h | 278 ++++ .../include/c++/11.2.0/debug/safe_container.h | 129 ++ .../include/c++/11.2.0/debug/safe_iterator.h | 1001 +++++++++++ .../c++/11.2.0/debug/safe_iterator.tcc | 551 +++++++ .../c++/11.2.0/debug/safe_local_iterator.h | 440 +++++ .../c++/11.2.0/debug/safe_local_iterator.tcc | 107 ++ .../include/c++/11.2.0/debug/safe_sequence.h | 150 ++ .../c++/11.2.0/debug/safe_sequence.tcc | 156 ++ .../c++/11.2.0/debug/safe_unordered_base.h | 185 +++ .../11.2.0/debug/safe_unordered_container.h | 104 ++ .../11.2.0/debug/safe_unordered_container.tcc | 100 ++ .../include/c++/11.2.0/debug/set | 44 + .../include/c++/11.2.0/debug/set.h | 664 ++++++++ .../include/c++/11.2.0/debug/stl_iterator.h | 132 ++ .../include/c++/11.2.0/debug/string | 1348 +++++++++++++++ .../include/c++/11.2.0/debug/unordered_map | 1467 +++++++++++++++++ .../include/c++/11.2.0/debug/unordered_set | 1295 +++++++++++++++ .../include/c++/11.2.0/debug/vector | 845 ++++++++++ .../samples/debug/callstacktest/Makefile | 25 + .../debug/callstacktest/callstacktest.c | 54 + .../ps2sdk/samples/debug/helloworld/Makefile | 25 + .../samples/debug/helloworld/helloworld.c | 35 + 37 files changed, 16468 insertions(+), 1 deletion(-) create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/assertions.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/bitset create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/debug.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/deque create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/formatter.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/forward_list create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/functions.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/helper_functions.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/list create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/macros.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/map create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/map.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/multimap.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/multiset.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_base.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_container.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_iterator.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_iterator.tcc create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_local_iterator.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_local_iterator.tcc create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_sequence.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_sequence.tcc create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_base.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_container.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_container.tcc create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/set create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/set.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/stl_iterator.h create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/string create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/unordered_map create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/unordered_set create mode 100644 external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/vector create mode 100644 external/ps2sdk/ps2sdk/samples/debug/callstacktest/Makefile create mode 100644 external/ps2sdk/ps2sdk/samples/debug/callstacktest/callstacktest.c create mode 100644 external/ps2sdk/ps2sdk/samples/debug/helloworld/Makefile create mode 100644 external/ps2sdk/ps2sdk/samples/debug/helloworld/helloworld.c diff --git a/.gitignore b/.gitignore index 25bace6..76e63b8 100644 --- a/.gitignore +++ b/.gitignore @@ -63,7 +63,7 @@ bld/ [Bb]uild/ !data/**/[Bb]in/ -!external/**/[Bb]in/ +!external/**/ # Visual Studio 2015 cache/options directory .vs/ diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/assertions.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/assertions.h new file mode 100644 index 0000000..e34061e --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/assertions.h @@ -0,0 +1,70 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/assertions.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_ASSERTIONS_H +#define _GLIBCXX_DEBUG_ASSERTIONS_H 1 + +#include + +#ifndef _GLIBCXX_DEBUG + +# define _GLIBCXX_DEBUG_ASSERT(_Condition) +# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) +# define _GLIBCXX_DEBUG_ONLY(_Statement) + +#endif + +#ifndef _GLIBCXX_ASSERTIONS +# define __glibcxx_requires_non_empty_range(_First,_Last) +# define __glibcxx_requires_nonempty() +# define __glibcxx_requires_subscript(_N) +#else + +// Verify that [_First, _Last) forms a non-empty iterator range. +# define __glibcxx_requires_non_empty_range(_First,_Last) \ + __glibcxx_assert(_First != _Last) +# define __glibcxx_requires_subscript(_N) \ + __glibcxx_assert(_N < this->size()) +// Verify that the container is nonempty +# define __glibcxx_requires_nonempty() \ + __glibcxx_assert(!this->empty()) +#endif + +#ifdef _GLIBCXX_DEBUG +# define _GLIBCXX_DEBUG_ASSERT(_Condition) __glibcxx_assert(_Condition) + +# ifdef _GLIBCXX_DEBUG_PEDANTIC +# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) _GLIBCXX_DEBUG_ASSERT(_Condition) +# else +# define _GLIBCXX_DEBUG_PEDASSERT(_Condition) +# endif + +# define _GLIBCXX_DEBUG_ONLY(_Statement) _Statement +#endif + +#endif // _GLIBCXX_DEBUG_ASSERTIONS diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/bitset b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/bitset new file mode 100644 index 0000000..782785c --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/bitset @@ -0,0 +1,429 @@ +// Debugging bitset implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/bitset + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_BITSET +#define _GLIBCXX_DEBUG_BITSET + +#pragma GCC system_header + +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::bitset with additional safety/checking/debug instrumentation. + template + class bitset + : public _GLIBCXX_STD_C::bitset<_Nb> +#if __cplusplus < 201103L + , public __gnu_debug::_Safe_sequence_base +#endif + { + typedef _GLIBCXX_STD_C::bitset<_Nb> _Base; + + public: + // In C++11 we rely on normal reference type to preserve the property + // of bitset to be use as a literal. + // TODO: Find another solution. +#if __cplusplus >= 201103L + typedef typename _Base::reference reference; +#else + // bit reference: + class reference + : private _Base::reference + , public __gnu_debug::_Safe_iterator_base + { + typedef typename _Base::reference _Base_ref; + + friend class bitset; + reference(); + + reference(const _Base_ref& __base, bitset* __seq) _GLIBCXX_NOEXCEPT + : _Base_ref(__base) + , _Safe_iterator_base(__seq, false) + { } + + public: + reference(const reference& __x) _GLIBCXX_NOEXCEPT + : _Base_ref(__x) + , _Safe_iterator_base(__x, false) + { } + + reference& + operator=(bool __x) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), + _M_message(__gnu_debug::__msg_bad_bitset_write) + ._M_iterator(*this)); + *static_cast<_Base_ref*>(this) = __x; + return *this; + } + + reference& + operator=(const reference& __x) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular(), + _M_message(__gnu_debug::__msg_bad_bitset_read) + ._M_iterator(__x)); + _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), + _M_message(__gnu_debug::__msg_bad_bitset_write) + ._M_iterator(*this)); + *static_cast<_Base_ref*>(this) = __x; + return *this; + } + + bool + operator~() const _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), + _M_message(__gnu_debug::__msg_bad_bitset_read) + ._M_iterator(*this)); + return ~(*static_cast(this)); + } + + operator bool() const _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), + _M_message(__gnu_debug::__msg_bad_bitset_read) + ._M_iterator(*this)); + return *static_cast(this); + } + + reference& + flip() _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), + _M_message(__gnu_debug::__msg_bad_bitset_flip) + ._M_iterator(*this)); + _Base_ref::flip(); + return *this; + } + }; +#endif + + // 23.3.5.1 constructors: + _GLIBCXX_CONSTEXPR bitset() _GLIBCXX_NOEXCEPT + : _Base() { } + +#if __cplusplus >= 201103L + constexpr bitset(unsigned long long __val) noexcept +#else + bitset(unsigned long __val) +#endif + : _Base(__val) { } + + template + explicit + bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str, + typename std::basic_string<_CharT, _Traits, _Alloc>::size_type + __pos = 0, + typename std::basic_string<_CharT, _Traits, _Alloc>::size_type + __n = (std::basic_string<_CharT, _Traits, _Alloc>::npos)) + : _Base(__str, __pos, __n) { } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 396. what are characters zero and one. + template + bitset(const std::basic_string<_CharT, _Traits, _Alloc>& __str, + typename std::basic_string<_CharT, _Traits, _Alloc>::size_type + __pos, + typename std::basic_string<_CharT, _Traits, _Alloc>::size_type + __n, + _CharT __zero, _CharT __one = _CharT('1')) + : _Base(__str, __pos, __n, __zero, __one) { } + + bitset(const _Base& __x) : _Base(__x) { } + +#if __cplusplus >= 201103L + template + explicit + bitset(const _CharT* __str, + typename std::basic_string<_CharT>::size_type __n + = std::basic_string<_CharT>::npos, + _CharT __zero = _CharT('0'), _CharT __one = _CharT('1')) + : _Base(__str, __n, __zero, __one) { } +#endif + + // 23.3.5.2 bitset operations: + bitset<_Nb>& + operator&=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT + { + _M_base() &= __rhs; + return *this; + } + + bitset<_Nb>& + operator|=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT + { + _M_base() |= __rhs; + return *this; + } + + bitset<_Nb>& + operator^=(const bitset<_Nb>& __rhs) _GLIBCXX_NOEXCEPT + { + _M_base() ^= __rhs; + return *this; + } + + bitset<_Nb>& + operator<<=(size_t __pos) _GLIBCXX_NOEXCEPT + { + _M_base() <<= __pos; + return *this; + } + + bitset<_Nb>& + operator>>=(size_t __pos) _GLIBCXX_NOEXCEPT + { + _M_base() >>= __pos; + return *this; + } + + bitset<_Nb>& + set() _GLIBCXX_NOEXCEPT + { + _Base::set(); + return *this; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 186. bitset::set() second parameter should be bool + bitset<_Nb>& + set(size_t __pos, bool __val = true) + { + _Base::set(__pos, __val); + return *this; + } + + bitset<_Nb>& + reset() _GLIBCXX_NOEXCEPT + { + _Base::reset(); + return *this; + } + + bitset<_Nb>& + reset(size_t __pos) + { + _Base::reset(__pos); + return *this; + } + + bitset<_Nb> + operator~() const _GLIBCXX_NOEXCEPT + { return bitset(~_M_base()); } + + bitset<_Nb>& + flip() _GLIBCXX_NOEXCEPT + { + _Base::flip(); + return *this; + } + + bitset<_Nb>& + flip(size_t __pos) + { + _Base::flip(__pos); + return *this; + } + + // element access: + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 11. Bitset minor problems + reference + operator[](size_t __pos) + { + __glibcxx_check_subscript(__pos); +#if __cplusplus >= 201103L + return _M_base()[__pos]; +#else + return reference(_M_base()[__pos], this); +#endif + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 11. Bitset minor problems + _GLIBCXX_CONSTEXPR bool + operator[](size_t __pos) const + { +#if __cplusplus < 201103L + // TODO: Check in debug-mode too. + __glibcxx_check_subscript(__pos); +#endif + return _Base::operator[](__pos); + } + + using _Base::to_ulong; +#if __cplusplus >= 201103L + using _Base::to_ullong; +#endif + + template + std::basic_string<_CharT, _Traits, _Alloc> + to_string() const + { return _M_base().template to_string<_CharT, _Traits, _Alloc>(); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 396. what are characters zero and one. + template + std::basic_string<_CharT, _Traits, _Alloc> + to_string(_CharT __zero, _CharT __one = _CharT('1')) const + { + return _M_base().template + to_string<_CharT, _Traits, _Alloc>(__zero, __one); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 434. bitset::to_string() hard to use. + template + std::basic_string<_CharT, _Traits, std::allocator<_CharT> > + to_string() const + { return to_string<_CharT, _Traits, std::allocator<_CharT> >(); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 853. to_string needs updating with zero and one. + template + std::basic_string<_CharT, _Traits, std::allocator<_CharT> > + to_string(_CharT __zero, _CharT __one = _CharT('1')) const + { return to_string<_CharT, _Traits, + std::allocator<_CharT> >(__zero, __one); } + + template + std::basic_string<_CharT, std::char_traits<_CharT>, + std::allocator<_CharT> > + to_string() const + { + return to_string<_CharT, std::char_traits<_CharT>, + std::allocator<_CharT> >(); + } + + template + std::basic_string<_CharT, std::char_traits<_CharT>, + std::allocator<_CharT> > + to_string(_CharT __zero, _CharT __one = _CharT('1')) const + { + return to_string<_CharT, std::char_traits<_CharT>, + std::allocator<_CharT> >(__zero, __one); + } + + std::basic_string, std::allocator > + to_string() const + { + return to_string,std::allocator >(); + } + + std::basic_string, std::allocator > + to_string(char __zero, char __one = '1') const + { + return to_string, + std::allocator >(__zero, __one); + } + + using _Base::count; + using _Base::size; + + bool + operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT + { return _M_base() == __rhs._M_base(); } + +#if __cpp_impl_three_way_comparison < 201907L + bool + operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT + { return _M_base() != __rhs._M_base(); } +#endif + + using _Base::test; + using _Base::all; + using _Base::any; + using _Base::none; + + bitset<_Nb> + operator<<(size_t __pos) const _GLIBCXX_NOEXCEPT + { return bitset<_Nb>(_M_base() << __pos); } + + bitset<_Nb> + operator>>(size_t __pos) const _GLIBCXX_NOEXCEPT + { return bitset<_Nb>(_M_base() >> __pos); } + + _Base& + _M_base() _GLIBCXX_NOEXCEPT + { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT + { return *this; } + }; + + template + bitset<_Nb> + operator&(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT + { return bitset<_Nb>(__x) &= __y; } + + template + bitset<_Nb> + operator|(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT + { return bitset<_Nb>(__x) |= __y; } + + template + bitset<_Nb> + operator^(const bitset<_Nb>& __x, const bitset<_Nb>& __y) _GLIBCXX_NOEXCEPT + { return bitset<_Nb>(__x) ^= __y; } + + template + std::basic_istream<_CharT, _Traits>& + operator>>(std::basic_istream<_CharT, _Traits>& __is, bitset<_Nb>& __x) + { return __is >> __x._M_base(); } + + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const bitset<_Nb>& __x) + { return __os << __x._M_base(); } + +} // namespace __debug + +#if __cplusplus >= 201103L + // DR 1182. + /// std::hash specialization for bitset. + template + struct hash<__debug::bitset<_Nb>> + : public __hash_base> + { + size_t + operator()(const __debug::bitset<_Nb>& __b) const noexcept + { return std::hash<_GLIBCXX_STD_C::bitset<_Nb>>()(__b._M_base()); } + }; +#endif + +} // namespace std + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/debug.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/debug.h new file mode 100644 index 0000000..116f2f0 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/debug.h @@ -0,0 +1,137 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/debug.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MACRO_SWITCH_H +#define _GLIBCXX_DEBUG_MACRO_SWITCH_H 1 + +/** Macros and namespaces used by the implementation outside of debug + * wrappers to verify certain properties. The __glibcxx_requires_xxx + * macros are merely wrappers around the __glibcxx_check_xxx wrappers + * when we are compiling with debug mode, but disappear when we are + * in release mode so that there is no checking performed in, e.g., + * the standard library algorithms. +*/ + +#include + +// Debug mode namespaces. + +/** + * @namespace std::__debug + * @brief GNU debug code, replaces standard behavior with debug behavior. + */ +namespace std +{ + namespace __debug { } +} + +/** @namespace __gnu_debug + * @brief GNU debug classes for public use. +*/ +namespace __gnu_debug +{ + using namespace std::__debug; + + template + struct _Safe_iterator; +} + +#ifndef _GLIBCXX_DEBUG + +# define __glibcxx_requires_cond(_Cond,_Msg) +# define __glibcxx_requires_valid_range(_First,_Last) +# define __glibcxx_requires_can_increment(_First,_Size) +# define __glibcxx_requires_can_increment_range(_First1,_Last1,_First2) +# define __glibcxx_requires_can_decrement_range(_First1,_Last1,_First2) +# define __glibcxx_requires_sorted(_First,_Last) +# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) +# define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) +# define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) +# define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_heap(_First,_Last) +# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) +# define __glibcxx_requires_string(_String) +# define __glibcxx_requires_string_len(_String,_Len) +# define __glibcxx_requires_irreflexive(_First,_Last) +# define __glibcxx_requires_irreflexive2(_First,_Last) +# define __glibcxx_requires_irreflexive_pred(_First,_Last,_Pred) +# define __glibcxx_requires_irreflexive_pred2(_First,_Last,_Pred) + +#else + +# include + +# define __glibcxx_requires_cond(_Cond,_Msg) _GLIBCXX_DEBUG_VERIFY(_Cond,_Msg) +# define __glibcxx_requires_valid_range(_First,_Last) \ + __glibcxx_check_valid_range(_First,_Last) +# define __glibcxx_requires_can_increment(_First,_Size) \ + __glibcxx_check_can_increment(_First,_Size) +# define __glibcxx_requires_can_increment_range(_First1,_Last1,_First2) \ + __glibcxx_check_can_increment_range(_First1,_Last1,_First2) +# define __glibcxx_requires_can_decrement_range(_First1,_Last1,_First2) \ + __glibcxx_check_can_decrement_range(_First1,_Last1,_First2) +# define __glibcxx_requires_sorted(_First,_Last) \ + __glibcxx_check_sorted(_First,_Last) +# define __glibcxx_requires_sorted_pred(_First,_Last,_Pred) \ + __glibcxx_check_sorted_pred(_First,_Last,_Pred) +# define __glibcxx_requires_sorted_set(_First1,_Last1,_First2) \ + __glibcxx_check_sorted_set(_First1,_Last1,_First2) +# define __glibcxx_requires_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ + __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) +# define __glibcxx_requires_partitioned_lower(_First,_Last,_Value) \ + __glibcxx_check_partitioned_lower(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_upper(_First,_Last,_Value) \ + __glibcxx_check_partitioned_upper(_First,_Last,_Value) +# define __glibcxx_requires_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ + __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ + __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) +# define __glibcxx_requires_heap(_First,_Last) \ + __glibcxx_check_heap(_First,_Last) +# define __glibcxx_requires_heap_pred(_First,_Last,_Pred) \ + __glibcxx_check_heap_pred(_First,_Last,_Pred) +# define __glibcxx_requires_string(_String) __glibcxx_check_string(_String) +# define __glibcxx_requires_string_len(_String,_Len) \ + __glibcxx_check_string_len(_String,_Len) +# define __glibcxx_requires_irreflexive(_First,_Last) \ + __glibcxx_check_irreflexive(_First,_Last) +# define __glibcxx_requires_irreflexive2(_First,_Last) \ + __glibcxx_check_irreflexive2(_First,_Last) +# define __glibcxx_requires_irreflexive_pred(_First,_Last,_Pred) \ + __glibcxx_check_irreflexive_pred(_First,_Last,_Pred) +# define __glibcxx_requires_irreflexive_pred2(_First,_Last,_Pred) \ + __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred) + +# include + +#endif + +#endif // _GLIBCXX_DEBUG_MACRO_SWITCH_H diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/deque b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/deque new file mode 100644 index 0000000..227d083 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/deque @@ -0,0 +1,707 @@ +// Debugging deque implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/deque + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_DEQUE +#define _GLIBCXX_DEBUG_DEQUE 1 + +#pragma GCC system_header + +#include +namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { + template class deque; +} } // namespace std::__debug + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::deque with safety/checking/debug instrumentation. + template > + class deque + : public __gnu_debug::_Safe_container< + deque<_Tp, _Allocator>, _Allocator, + __gnu_debug::_Safe_sequence>, + public _GLIBCXX_STD_C::deque<_Tp, _Allocator> + { + typedef _GLIBCXX_STD_C::deque<_Tp, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + deque, _Allocator, __gnu_debug::_Safe_sequence> _Safe; + + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + + template + friend class ::__gnu_debug::_Safe_iterator; + + // Reference wrapper for base class. Disambiguates deque(const _Base&) + // from copy constructor by requiring a user-defined conversion. + // See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator<_Base_iterator, deque> + iterator; + typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, deque> + const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + + typedef _Tp value_type; + typedef _Allocator allocator_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.2.1.1 construct/copy/destroy: + +#if __cplusplus < 201103L + deque() + : _Base() { } + + deque(const deque& __x) + : _Base(__x) { } + + ~deque() { } +#else + deque() = default; + deque(const deque&) = default; + deque(deque&&) = default; + + deque(const deque& __d, const _Allocator& __a) + : _Base(__d, __a) { } + + deque(deque&& __d, const _Allocator& __a) + : _Safe(std::move(__d)), _Base(std::move(__d), __a) { } + + deque(initializer_list __l, + const allocator_type& __a = allocator_type()) + : _Base(__l, __a) { } + + ~deque() = default; +#endif + + explicit + deque(const _Allocator& __a) + : _Base(__a) { } + +#if __cplusplus >= 201103L + explicit + deque(size_type __n, const _Allocator& __a = _Allocator()) + : _Base(__n, __a) { } + + deque(size_type __n, const _Tp& __value, + const _Allocator& __a = _Allocator()) + : _Base(__n, __value, __a) { } +#else + explicit + deque(size_type __n, const _Tp& __value = _Tp(), + const _Allocator& __a = _Allocator()) + : _Base(__n, __value, __a) { } +#endif + +#if __cplusplus >= 201103L + template> +#else + template +#endif + deque(_InputIterator __first, _InputIterator __last, + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __a) + { } + + deque(_Base_ref __x) + : _Base(__x._M_ref) { } + +#if __cplusplus < 201103L + deque& + operator=(const deque& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + return *this; + } +#else + deque& + operator=(const deque&) = default; + + deque& + operator=(deque&&) = default; + + deque& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } +#endif + +#if __cplusplus >= 201103L + template> +#else + template +#endif + void + assign(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::assign(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::assign(__first, __last); + + this->_M_invalidate_all(); + } + + void + assign(size_type __n, const _Tp& __t) + { + _Base::assign(__n, __t); + this->_M_invalidate_all(); + } + +#if __cplusplus >= 201103L + void + assign(initializer_list __l) + { + _Base::assign(__l); + this->_M_invalidate_all(); + } +#endif + + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + private: + void + _M_invalidate_after_nth(difference_type __n) + { + typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth; + this->_M_invalidate_if(_After_nth(__n, _Base::begin())); + } + + public: + // 23.2.1.2 capacity: + using _Base::size; + using _Base::max_size; + +#if __cplusplus >= 201103L + void + resize(size_type __sz) + { + bool __invalidate_all = __sz > this->size(); + if (__sz < this->size()) + this->_M_invalidate_after_nth(__sz); + + _Base::resize(__sz); + + if (__invalidate_all) + this->_M_invalidate_all(); + } + + void + resize(size_type __sz, const _Tp& __c) + { + bool __invalidate_all = __sz > this->size(); + if (__sz < this->size()) + this->_M_invalidate_after_nth(__sz); + + _Base::resize(__sz, __c); + + if (__invalidate_all) + this->_M_invalidate_all(); + } +#else + void + resize(size_type __sz, _Tp __c = _Tp()) + { + bool __invalidate_all = __sz > this->size(); + if (__sz < this->size()) + this->_M_invalidate_after_nth(__sz); + + _Base::resize(__sz, __c); + + if (__invalidate_all) + this->_M_invalidate_all(); + } +#endif + +#if __cplusplus >= 201103L + void + shrink_to_fit() noexcept + { + if (_Base::_M_shrink_to_fit()) + this->_M_invalidate_all(); + } +#endif + + using _Base::empty; + + // element access: + reference + operator[](size_type __n) _GLIBCXX_NOEXCEPT + { + __glibcxx_check_subscript(__n); + return _M_base()[__n]; + } + + const_reference + operator[](size_type __n) const _GLIBCXX_NOEXCEPT + { + __glibcxx_check_subscript(__n); + return _M_base()[__n]; + } + + using _Base::at; + + reference + front() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::front(); + } + + const_reference + front() const _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::front(); + } + + reference + back() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::back(); + } + + const_reference + back() const _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::back(); + } + + // 23.2.1.3 modifiers: + void + push_front(const _Tp& __x) + { + _Base::push_front(__x); + this->_M_invalidate_all(); + } + + void + push_back(const _Tp& __x) + { + _Base::push_back(__x); + this->_M_invalidate_all(); + } + +#if __cplusplus >= 201103L + void + push_front(_Tp&& __x) + { emplace_front(std::move(__x)); } + + void + push_back(_Tp&& __x) + { emplace_back(std::move(__x)); } + + template +#if __cplusplus > 201402L + reference +#else + void +#endif + emplace_front(_Args&&... __args) + { + _Base::emplace_front(std::forward<_Args>(__args)...); + this->_M_invalidate_all(); +#if __cplusplus > 201402L + return front(); +#endif + } + + template +#if __cplusplus > 201402L + reference +#else + void +#endif + emplace_back(_Args&&... __args) + { + _Base::emplace_back(std::forward<_Args>(__args)...); + this->_M_invalidate_all(); +#if __cplusplus > 201402L + return back(); +#endif + } + + template + iterator + emplace(const_iterator __position, _Args&&... __args) + { + __glibcxx_check_insert(__position); + _Base_iterator __res = _Base::emplace(__position.base(), + std::forward<_Args>(__args)...); + this->_M_invalidate_all(); + return iterator(__res, this); + } +#endif + + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const _Tp& __x) +#else + insert(iterator __position, const _Tp& __x) +#endif + { + __glibcxx_check_insert(__position); + _Base_iterator __res = _Base::insert(__position.base(), __x); + this->_M_invalidate_all(); + return iterator(__res, this); + } + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, _Tp&& __x) + { return emplace(__position, std::move(__x)); } + + iterator + insert(const_iterator __position, initializer_list __l) + { + __glibcxx_check_insert(__position); + _Base_iterator __res = _Base::insert(__position.base(), __l); + this->_M_invalidate_all(); + return iterator(__res, this); + } +#endif + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, size_type __n, const _Tp& __x) + { + __glibcxx_check_insert(__position); + _Base_iterator __res = _Base::insert(__position.base(), __n, __x); + this->_M_invalidate_all(); + return iterator(__res, this); + } +#else + void + insert(iterator __position, size_type __n, const _Tp& __x) + { + __glibcxx_check_insert(__position); + _Base::insert(__position.base(), __n, __x); + this->_M_invalidate_all(); + } +#endif + +#if __cplusplus >= 201103L + template> + iterator + insert(const_iterator __position, + _InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_insert_range(__position, __first, __last, __dist); + _Base_iterator __res; + if (__dist.second >= __gnu_debug::__dp_sign) + __res = _Base::insert(__position.base(), + __gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + __res = _Base::insert(__position.base(), __first, __last); + + this->_M_invalidate_all(); + return iterator(__res, this); + } +#else + template + void + insert(iterator __position, + _InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_insert_range(__position, __first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__position.base(), + __gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__position.base(), __first, __last); + + this->_M_invalidate_all(); + } +#endif + + void + pop_front() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + this->_M_invalidate_if(_Equal(_Base::begin())); + _Base::pop_front(); + } + + void + pop_back() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + this->_M_invalidate_if(_Equal(--_Base::end())); + _Base::pop_back(); + } + + iterator +#if __cplusplus >= 201103L + erase(const_iterator __position) +#else + erase(iterator __position) +#endif + { + __glibcxx_check_erase(__position); +#if __cplusplus >= 201103L + _Base_const_iterator __victim = __position.base(); +#else + _Base_iterator __victim = __position.base(); +#endif + if (__victim == _Base::begin() || __victim == _Base::end() - 1) + { + this->_M_invalidate_if(_Equal(__victim)); + return iterator(_Base::erase(__victim), this); + } + else + { + _Base_iterator __res = _Base::erase(__victim); + this->_M_invalidate_all(); + return iterator(__res, this); + } + } + + iterator +#if __cplusplus >= 201103L + erase(const_iterator __first, const_iterator __last) +#else + erase(iterator __first, iterator __last) +#endif + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + + if (__first.base() == __last.base()) +#if __cplusplus >= 201103L + return iterator(__first.base()._M_const_cast(), this); +#else + return __first; +#endif + else if (__first.base() == _Base::begin() + || __last.base() == _Base::end()) + { + this->_M_detach_singular(); + for (_Base_const_iterator __position = __first.base(); + __position != __last.base(); ++__position) + { + this->_M_invalidate_if(_Equal(__position)); + } + __try + { + return iterator(_Base::erase(__first.base(), __last.base()), + this); + } + __catch(...) + { + this->_M_revalidate_singular(); + __throw_exception_again; + } + } + else + { + _Base_iterator __res = _Base::erase(__first.base(), + __last.base()); + this->_M_invalidate_all(); + return iterator(__res, this); + } + } + + void + swap(deque& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + _Base::clear(); + this->_M_invalidate_all(); + } + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + }; + +#if __cpp_deduction_guides >= 201606 + template::value_type, + typename _Allocator = allocator<_ValT>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireAllocator<_Allocator>> + deque(_InputIterator, _InputIterator, _Allocator = _Allocator()) + -> deque<_ValT, _Allocator>; +#endif + + template + inline bool + operator==(const deque<_Tp, _Alloc>& __lhs, + const deque<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + +#if __cpp_lib_three_way_comparison + template + constexpr __detail::__synth3way_t<_Tp> + operator<=>(const deque<_Tp, _Alloc>& __x, const deque<_Tp, _Alloc>& __y) + { return __x._M_base() <=> __y._M_base(); } +#else + template + inline bool + operator!=(const deque<_Tp, _Alloc>& __lhs, + const deque<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const deque<_Tp, _Alloc>& __lhs, + const deque<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const deque<_Tp, _Alloc>& __lhs, + const deque<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const deque<_Tp, _Alloc>& __lhs, + const deque<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const deque<_Tp, _Alloc>& __lhs, + const deque<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } +#endif // three-way comparison + + template + inline void + swap(deque<_Tp, _Alloc>& __lhs, deque<_Tp, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs))) + { __lhs.swap(__rhs); } + +} // namespace __debug +} // namespace std + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/formatter.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/formatter.h new file mode 100644 index 0000000..7140fed --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/formatter.h @@ -0,0 +1,594 @@ +// Debug-mode error formatting implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/formatter.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_FORMATTER_H +#define _GLIBCXX_DEBUG_FORMATTER_H 1 + +#include + +#if __cpp_rtti +# include +# define _GLIBCXX_TYPEID(_Type) &typeid(_Type) +#else +namespace std +{ + class type_info; +} +# define _GLIBCXX_TYPEID(_Type) 0 +#endif + +#if __cplusplus >= 201103L +namespace __gnu_cxx +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +template + class __normal_iterator; + +_GLIBCXX_END_NAMESPACE_VERSION +} + +namespace std +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +template + class reverse_iterator; + +template + class move_iterator; + +_GLIBCXX_END_NAMESPACE_VERSION +} +#endif + +namespace __gnu_debug +{ + using std::type_info; + + template + _GLIBCXX_CONSTEXPR + bool __check_singular(_Iterator const&); + + class _Safe_sequence_base; + + template + class _Safe_iterator; + + template + class _Safe_local_iterator; + + template + class _Safe_sequence; + + enum _Debug_msg_id + { + // General checks + __msg_valid_range, + __msg_insert_singular, + __msg_insert_different, + __msg_erase_bad, + __msg_erase_different, + __msg_subscript_oob, + __msg_empty, + __msg_unpartitioned, + __msg_unpartitioned_pred, + __msg_unsorted, + __msg_unsorted_pred, + __msg_not_heap, + __msg_not_heap_pred, + // std::bitset checks + __msg_bad_bitset_write, + __msg_bad_bitset_read, + __msg_bad_bitset_flip, + // std::list checks + __msg_self_splice, + __msg_splice_alloc, + __msg_splice_bad, + __msg_splice_other, + __msg_splice_overlap, + // iterator checks + __msg_init_singular, + __msg_init_copy_singular, + __msg_init_const_singular, + __msg_copy_singular, + __msg_bad_deref, + __msg_bad_inc, + __msg_bad_dec, + __msg_iter_subscript_oob, + __msg_advance_oob, + __msg_retreat_oob, + __msg_iter_compare_bad, + __msg_compare_different, + __msg_iter_order_bad, + __msg_order_different, + __msg_distance_bad, + __msg_distance_different, + // istream_iterator + __msg_deref_istream, + __msg_inc_istream, + // ostream_iterator + __msg_output_ostream, + // istreambuf_iterator + __msg_deref_istreambuf, + __msg_inc_istreambuf, + // forward_list + __msg_insert_after_end, + __msg_erase_after_bad, + __msg_valid_range2, + // unordered container local iterators + __msg_local_iter_compare_bad, + __msg_non_empty_range, + // self move assign (no longer used) + __msg_self_move_assign, + // unordered container buckets + __msg_bucket_index_oob, + __msg_valid_load_factor, + // others + __msg_equal_allocs, + __msg_insert_range_from_self, + __msg_irreflexive_ordering + }; + + class _Error_formatter + { + // Tags denoting the type of parameter for construction + struct _Is_iterator { }; + struct _Is_iterator_value_type { }; + struct _Is_sequence { }; + struct _Is_instance { }; + + public: + /// Whether an iterator is constant, mutable, or unknown + enum _Constness + { + __unknown_constness, + __const_iterator, + __mutable_iterator, + __last_constness + }; + + // The state of the iterator (fine-grained), if we know it. + enum _Iterator_state + { + __unknown_state, + __singular, // singular, may still be attached to a sequence + __begin, // dereferenceable, and at the beginning + __middle, // dereferenceable, not at the beginning + __end, // past-the-end, may be at beginning if sequence empty + __before_begin, // before begin + __rbegin, // dereferenceable, and at the reverse-beginning + __rmiddle, // reverse-dereferenceable, not at the reverse-beginning + __rend, // reverse-past-the-end + __last_state + }; + + // A parameter that may be referenced by an error message + struct _Parameter + { + enum + { + __unused_param, + __iterator, + __sequence, + __integer, + __string, + __instance, + __iterator_value_type + } _M_kind; + + struct _Type + { + const char* _M_name; + const type_info* _M_type; + }; + + struct _Instance : _Type + { + const void* _M_address; + }; + + union + { + // When _M_kind == __iterator + struct : _Instance + { + _Constness _M_constness; + _Iterator_state _M_state; + const void* _M_sequence; + const type_info* _M_seq_type; + } _M_iterator; + + // When _M_kind == __sequence + _Instance _M_sequence; + + // When _M_kind == __integer + struct + { + const char* _M_name; + long _M_value; + } _M_integer; + + // When _M_kind == __string + struct + { + const char* _M_name; + const char* _M_value; + } _M_string; + + // When _M_kind == __instance + _Instance _M_instance; + + // When _M_kind == __iterator_value_type + _Type _M_iterator_value_type; + } _M_variant; + + _Parameter() : _M_kind(__unused_param), _M_variant() { } + + _Parameter(long __value, const char* __name) + : _M_kind(__integer), _M_variant() + { + _M_variant._M_integer._M_name = __name; + _M_variant._M_integer._M_value = __value; + } + + _Parameter(const char* __value, const char* __name) + : _M_kind(__string), _M_variant() + { + _M_variant._M_string._M_name = __name; + _M_variant._M_string._M_value = __value; + } + + template + _Parameter(_Safe_iterator<_Iterator, _Sequence, _Category> const& __it, + const char* __name, _Is_iterator) + : _M_kind(__iterator), _M_variant() + { + _M_variant._M_iterator._M_name = __name; + _M_variant._M_iterator._M_address = std::__addressof(__it); + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(_Iterator); + _M_variant._M_iterator._M_constness = + __it._S_constant() ? __const_iterator : __mutable_iterator; + _M_variant._M_iterator._M_sequence = __it._M_get_sequence(); + _M_variant._M_iterator._M_seq_type = _GLIBCXX_TYPEID(_Sequence); + + if (__it._M_singular()) + _M_variant._M_iterator._M_state = __singular; + else + { + if (__it._M_is_before_begin()) + _M_variant._M_iterator._M_state = __before_begin; + else if (__it._M_is_end()) + _M_variant._M_iterator._M_state = __end; + else if (__it._M_is_begin()) + _M_variant._M_iterator._M_state = __begin; + else + _M_variant._M_iterator._M_state = __middle; + } + } + + template + _Parameter(_Safe_local_iterator<_Iterator, _Sequence> const& __it, + const char* __name, _Is_iterator) + : _M_kind(__iterator), _M_variant() + { + _M_variant._M_iterator._M_name = __name; + _M_variant._M_iterator._M_address = std::__addressof(__it); + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(_Iterator); + _M_variant._M_iterator._M_constness = + __it._S_constant() ? __const_iterator : __mutable_iterator; + _M_variant._M_iterator._M_sequence = __it._M_get_sequence(); + _M_variant._M_iterator._M_seq_type = _GLIBCXX_TYPEID(_Sequence); + + if (__it._M_singular()) + _M_variant._M_iterator._M_state = __singular; + else + { + if (__it._M_is_end()) + _M_variant._M_iterator._M_state = __end; + else if (__it._M_is_begin()) + _M_variant._M_iterator._M_state = __begin; + else + _M_variant._M_iterator._M_state = __middle; + } + } + + template + _Parameter(const _Type* const& __it, const char* __name, _Is_iterator) + : _M_kind(__iterator), _M_variant() + { + _M_variant._M_iterator._M_name = __name; + _M_variant._M_iterator._M_address = std::__addressof(__it); + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); + _M_variant._M_iterator._M_constness = __const_iterator; + _M_variant._M_iterator._M_state = __it ? __unknown_state : __singular; + _M_variant._M_iterator._M_sequence = 0; + _M_variant._M_iterator._M_seq_type = 0; + } + + template + _Parameter(_Type* const& __it, const char* __name, _Is_iterator) + : _M_kind(__iterator), _M_variant() + { + _M_variant._M_iterator._M_name = __name; + _M_variant._M_iterator._M_address = std::__addressof(__it); + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); + _M_variant._M_iterator._M_constness = __mutable_iterator; + _M_variant._M_iterator._M_state = __it ? __unknown_state : __singular; + _M_variant._M_iterator._M_sequence = 0; + _M_variant._M_iterator._M_seq_type = 0; + } + + template + _Parameter(_Iterator const& __it, const char* __name, _Is_iterator) + : _M_kind(__iterator), _M_variant() + { + _M_variant._M_iterator._M_name = __name; + _M_variant._M_iterator._M_address = std::__addressof(__it); + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); + _M_variant._M_iterator._M_constness = __unknown_constness; + _M_variant._M_iterator._M_state = + __gnu_debug::__check_singular(__it) ? __singular : __unknown_state; + _M_variant._M_iterator._M_sequence = 0; + _M_variant._M_iterator._M_seq_type = 0; + } + +#if __cplusplus >= 201103L + // The following constructors are only defined in C++11 to take + // advantage of the constructor delegation feature. + template + _Parameter( + __gnu_cxx::__normal_iterator<_Iterator, _Container> const& __it, + const char* __name, _Is_iterator) + : _Parameter(__it.base(), __name, _Is_iterator{}) + { _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); } + + template + _Parameter(std::reverse_iterator<_Iterator> const& __it, + const char* __name, _Is_iterator) + : _Parameter(__it.base(), __name, _Is_iterator{}) + { + _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); + _M_variant._M_iterator._M_state + = _S_reverse_state(_M_variant._M_iterator._M_state); + } + + template + _Parameter(std::reverse_iterator<_Safe_iterator<_Iterator, _Sequence, + _Category>> const& __it, + const char* __name, _Is_iterator) + : _Parameter(__it.base(), __name, _Is_iterator{}) + { + _M_variant._M_iterator._M_type + = _GLIBCXX_TYPEID(std::reverse_iterator<_Iterator>); + _M_variant._M_iterator._M_state + = _S_reverse_state(_M_variant._M_iterator._M_state); + } + + template + _Parameter(std::move_iterator<_Iterator> const& __it, + const char* __name, _Is_iterator) + : _Parameter(__it.base(), __name, _Is_iterator{}) + { _M_variant._M_iterator._M_type = _GLIBCXX_TYPEID(__it); } + + template + _Parameter(std::move_iterator<_Safe_iterator<_Iterator, _Sequence, + _Category>> const& __it, + const char* __name, _Is_iterator) + : _Parameter(__it.base(), __name, _Is_iterator{}) + { + _M_variant._M_iterator._M_type + = _GLIBCXX_TYPEID(std::move_iterator<_Iterator>); + } + + private: + _Iterator_state + _S_reverse_state(_Iterator_state __state) + { + switch (__state) + { + case __begin: + return __rend; + case __middle: + return __rmiddle; + case __end: + return __rbegin; + default: + return __state; + } + } + + public: +#endif + + template + _Parameter(const _Safe_sequence<_Sequence>& __seq, + const char* __name, _Is_sequence) + : _M_kind(__sequence), _M_variant() + { + _M_variant._M_sequence._M_name = __name; + _M_variant._M_sequence._M_address = + static_cast(std::__addressof(__seq)); + _M_variant._M_sequence._M_type = _GLIBCXX_TYPEID(_Sequence); + } + + template + _Parameter(const _Sequence& __seq, const char* __name, _Is_sequence) + : _M_kind(__sequence), _M_variant() + { + _M_variant._M_sequence._M_name = __name; + _M_variant._M_sequence._M_address = std::__addressof(__seq); + _M_variant._M_sequence._M_type = _GLIBCXX_TYPEID(_Sequence); + } + + template + _Parameter(const _Iterator& __it, const char* __name, + _Is_iterator_value_type) + : _M_kind(__iterator_value_type), _M_variant() + { + _M_variant._M_iterator_value_type._M_name = __name; + _M_variant._M_iterator_value_type._M_type = + _GLIBCXX_TYPEID(typename std::iterator_traits<_Iterator>::value_type); + } + + template + _Parameter(const _Type& __inst, const char* __name, _Is_instance) + : _M_kind(__instance), _M_variant() + { + _M_variant._M_instance._M_name = __name; + _M_variant._M_instance._M_address = &__inst; + _M_variant._M_instance._M_type = _GLIBCXX_TYPEID(_Type); + } + +#if !_GLIBCXX_INLINE_VERSION + void + _M_print_field(const _Error_formatter* __formatter, + const char* __name) const _GLIBCXX_DEPRECATED; + + void + _M_print_description(const _Error_formatter* __formatter) + const _GLIBCXX_DEPRECATED; +#endif + }; + + template + _Error_formatter& + _M_iterator(const _Iterator& __it, const char* __name = 0) + { + if (_M_num_parameters < std::size_t(__max_parameters)) + _M_parameters[_M_num_parameters++] = _Parameter(__it, __name, + _Is_iterator()); + return *this; + } + + template + _Error_formatter& + _M_iterator_value_type(const _Iterator& __it, + const char* __name = 0) + { + if (_M_num_parameters < __max_parameters) + _M_parameters[_M_num_parameters++] = + _Parameter(__it, __name, _Is_iterator_value_type()); + return *this; + } + + _Error_formatter& + _M_integer(long __value, const char* __name = 0) + { + if (_M_num_parameters < __max_parameters) + _M_parameters[_M_num_parameters++] = _Parameter(__value, __name); + return *this; + } + + _Error_formatter& + _M_string(const char* __value, const char* __name = 0) + { + if (_M_num_parameters < __max_parameters) + _M_parameters[_M_num_parameters++] = _Parameter(__value, __name); + return *this; + } + + template + _Error_formatter& + _M_sequence(const _Sequence& __seq, const char* __name = 0) + { + if (_M_num_parameters < __max_parameters) + _M_parameters[_M_num_parameters++] = _Parameter(__seq, __name, + _Is_sequence()); + return *this; + } + + template + _Error_formatter& + _M_instance(const _Type& __inst, const char* __name = 0) + { + if (_M_num_parameters < __max_parameters) + _M_parameters[_M_num_parameters++] = _Parameter(__inst, __name, + _Is_instance()); + return *this; + } + + _Error_formatter& + _M_message(const char* __text) + { _M_text = __text; return *this; } + + // Kept const qualifier for backward compatibility, to keep the same + // exported symbol. + _Error_formatter& + _M_message(_Debug_msg_id __id) const throw (); + + _GLIBCXX_NORETURN void + _M_error() const; + +#if !_GLIBCXX_INLINE_VERSION + template + void + _M_format_word(char*, int, const char*, _Tp) + const throw () _GLIBCXX_DEPRECATED; + + void + _M_print_word(const char* __word) const _GLIBCXX_DEPRECATED; + + void + _M_print_string(const char* __string) const _GLIBCXX_DEPRECATED; +#endif + + private: + _Error_formatter(const char* __file, unsigned int __line, + const char* __function) + : _M_file(__file), _M_line(__line), _M_num_parameters(0), _M_text(0) + , _M_function(__function) + { } + +#if !_GLIBCXX_INLINE_VERSION + void + _M_get_max_length() const throw () _GLIBCXX_DEPRECATED; +#endif + + enum { __max_parameters = 9 }; + + const char* _M_file; + unsigned int _M_line; + _Parameter _M_parameters[__max_parameters]; + unsigned int _M_num_parameters; + const char* _M_text; + const char* _M_function; + + public: + static _Error_formatter& + _S_at(const char* __file, unsigned int __line, const char* __function) + { + static _Error_formatter __formatter(__file, __line, __function); + return __formatter; + } + }; +} // namespace __gnu_debug + +#undef _GLIBCXX_TYPEID + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/forward_list b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/forward_list new file mode 100644 index 0000000..16f0531 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/forward_list @@ -0,0 +1,947 @@ +// -*- C++ -*- + +// Copyright (C) 2010-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/forward_list + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_FORWARD_LIST +#define _GLIBCXX_DEBUG_FORWARD_LIST 1 + +#pragma GCC system_header + +#include +namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { + template class forward_list; +} } // namespace std::__debug + +#include +#include +#include +#include + +// Special validity check for forward_list ranges. +#define __glibcxx_check_valid_fl_range(_First,_Last,_Dist) \ +_GLIBCXX_DEBUG_VERIFY(_First._M_valid_range(_Last, _Dist, false), \ + _M_message(__gnu_debug::__msg_valid_range) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +namespace __gnu_debug +{ + /// Special iterators swap and invalidation for forward_list because of the + /// before_begin iterator. + template + class _Safe_forward_list + : public _Safe_sequence<_SafeSequence> + { + _SafeSequence& + _M_this() noexcept + { return *static_cast<_SafeSequence*>(this); } + + static void + _M_swap_aux(_Safe_sequence_base& __lhs, + _Safe_iterator_base*& __lhs_iterators, + _Safe_sequence_base& __rhs, + _Safe_iterator_base*& __rhs_iterators); + + void _M_swap_single(_Safe_sequence_base&) noexcept; + + protected: + void + _M_invalidate_all() + { + using _Base_const_iterator = __decltype(_M_this()._M_base().cend()); + this->_M_invalidate_if([this](_Base_const_iterator __it) + { + return __it != _M_this()._M_base().cbefore_begin() + && __it != _M_this()._M_base().cend(); }); + } + + void _M_swap(_Safe_sequence_base&) noexcept; + }; + + template + void + _Safe_forward_list<_SafeSequence>:: + _M_swap_aux(_Safe_sequence_base& __lhs, + _Safe_iterator_base*& __lhs_iterators, + _Safe_sequence_base& __rhs, + _Safe_iterator_base*& __rhs_iterators) + { + using const_iterator = typename _SafeSequence::const_iterator; + _Safe_iterator_base* __bbegin_its = 0; + _Safe_iterator_base* __last_bbegin = 0; + _SafeSequence& __rseq = static_cast<_SafeSequence&>(__rhs); + + for (_Safe_iterator_base* __iter = __lhs_iterators; __iter;) + { + // Even iterator is cast to const_iterator, not a problem. + _Safe_iterator_base* __victim_base = __iter; + const_iterator* __victim = + static_cast(__victim_base); + __iter = __iter->_M_next; + if (__victim->base() == __rseq._M_base().cbefore_begin()) + { + __victim->_M_unlink(); + if (__lhs_iterators == __victim_base) + __lhs_iterators = __victim_base->_M_next; + if (__bbegin_its) + { + __victim_base->_M_next = __bbegin_its; + __bbegin_its->_M_prior = __victim_base; + } + else + __last_bbegin = __victim_base; + __bbegin_its = __victim_base; + } + else + __victim_base->_M_sequence = std::__addressof(__lhs); + } + + if (__bbegin_its) + { + if (__rhs_iterators) + { + __rhs_iterators->_M_prior = __last_bbegin; + __last_bbegin->_M_next = __rhs_iterators; + } + __rhs_iterators = __bbegin_its; + } + } + + template + void + _Safe_forward_list<_SafeSequence>:: + _M_swap_single(_Safe_sequence_base& __other) noexcept + { + std::swap(_M_this()._M_iterators, __other._M_iterators); + std::swap(_M_this()._M_const_iterators, __other._M_const_iterators); + // Useless, always 1 on forward_list + //std::swap(_M_this()_M_version, __other._M_version); + _Safe_iterator_base* __this_its = _M_this()._M_iterators; + _M_swap_aux(__other, __other._M_iterators, + _M_this(), _M_this()._M_iterators); + _Safe_iterator_base* __this_const_its = _M_this()._M_const_iterators; + _M_swap_aux(__other, __other._M_const_iterators, + _M_this(), _M_this()._M_const_iterators); + _M_swap_aux(_M_this(), __this_its, + __other, __other._M_iterators); + _M_swap_aux(_M_this(), __this_const_its, + __other, __other._M_const_iterators); + } + + /* Special forward_list _M_swap version that does not swap the + * before-begin ownership.*/ + template + void + _Safe_forward_list<_SafeSequence>:: + _M_swap(_Safe_sequence_base& __other) noexcept + { + // We need to lock both sequences to swap + using namespace __gnu_cxx; + __mutex *__this_mutex = &_M_this()._M_get_mutex(); + __mutex *__other_mutex = + &static_cast<_SafeSequence&>(__other)._M_get_mutex(); + if (__this_mutex == __other_mutex) + { + __scoped_lock __lock(*__this_mutex); + _M_swap_single(__other); + } + else + { + __scoped_lock __l1(__this_mutex < __other_mutex + ? *__this_mutex : *__other_mutex); + __scoped_lock __l2(__this_mutex < __other_mutex + ? *__other_mutex : *__this_mutex); + _M_swap_single(__other); + } + } +} + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::forward_list with safety/checking/debug instrumentation. + template > + class forward_list + : public __gnu_debug::_Safe_container< + forward_list<_Tp, _Alloc>, _Alloc, __gnu_debug::_Safe_forward_list>, + public _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> + { + typedef _GLIBCXX_STD_C::forward_list<_Tp, _Alloc> _Base; + typedef __gnu_debug::_Safe_container< + forward_list, _Alloc, __gnu_debug::_Safe_forward_list> _Safe; + + typedef typename _Base::iterator _Base_iterator; + typedef typename _Base::const_iterator _Base_const_iterator; + + template + friend class ::__gnu_debug::_Safe_iterator; + + // Reference wrapper for base class. See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator< + _Base_iterator, forward_list> iterator; + typedef __gnu_debug::_Safe_iterator< + _Base_const_iterator, forward_list> const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + + typedef _Tp value_type; + typedef typename _Base::allocator_type allocator_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + + // 23.2.3.1 construct/copy/destroy: + + forward_list() = default; + + explicit + forward_list(const allocator_type& __al) noexcept + : _Base(__al) { } + + forward_list(const forward_list& __list, const allocator_type& __al) + : _Base(__list, __al) + { } + + forward_list(forward_list&& __list, const allocator_type& __al) + noexcept( + std::is_nothrow_constructible<_Base, + _Base, const allocator_type&>::value ) + : _Safe(std::move(__list._M_safe()), __al), + _Base(std::move(__list._M_base()), __al) + { } + + explicit + forward_list(size_type __n, const allocator_type& __al = allocator_type()) + : _Base(__n, __al) + { } + + forward_list(size_type __n, const _Tp& __value, + const allocator_type& __al = allocator_type()) + : _Base(__n, __value, __al) + { } + + template> + forward_list(_InputIterator __first, _InputIterator __last, + const allocator_type& __al = allocator_type()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __al) + { } + + forward_list(const forward_list&) = default; + + forward_list(forward_list&&) = default; + + forward_list(std::initializer_list<_Tp> __il, + const allocator_type& __al = allocator_type()) + : _Base(__il, __al) + { } + + ~forward_list() = default; + + forward_list(_Base_ref __x) : _Base(__x._M_ref) { } + + forward_list& + operator=(const forward_list&) = default; + + forward_list& + operator=(forward_list&&) = default; + + forward_list& + operator=(std::initializer_list<_Tp> __il) + { + _M_base() = __il; + this->_M_invalidate_all(); + return *this; + } + + template> + void + assign(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::assign(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::assign(__first, __last); + + this->_M_invalidate_all(); + } + + void + assign(size_type __n, const _Tp& __val) + { + _Base::assign(__n, __val); + this->_M_invalidate_all(); + } + + void + assign(std::initializer_list<_Tp> __il) + { + _Base::assign(__il); + this->_M_invalidate_all(); + } + + using _Base::get_allocator; + + // iterators: + + iterator + before_begin() noexcept + { return { _Base::before_begin(), this }; } + + const_iterator + before_begin() const noexcept + { return { _Base::before_begin(), this }; } + + iterator + begin() noexcept + { return { _Base::begin(), this }; } + + const_iterator + begin() const noexcept + { return { _Base::begin(), this }; } + + iterator + end() noexcept + { return { _Base::end(), this }; } + + const_iterator + end() const noexcept + { return { _Base::end(), this }; } + + const_iterator + cbegin() const noexcept + { return { _Base::cbegin(), this }; } + + const_iterator + cbefore_begin() const noexcept + { return { _Base::cbefore_begin(), this }; } + + const_iterator + cend() const noexcept + { return { _Base::cend(), this }; } + + using _Base::empty; + using _Base::max_size; + + // element access: + + reference + front() + { + __glibcxx_check_nonempty(); + return _Base::front(); + } + + const_reference + front() const + { + __glibcxx_check_nonempty(); + return _Base::front(); + } + + // modifiers: + + using _Base::emplace_front; + using _Base::push_front; + + void + pop_front() + { + __glibcxx_check_nonempty(); + this->_M_invalidate_if([this](_Base_const_iterator __it) + { return __it == this->_M_base().cbegin(); }); + _Base::pop_front(); + } + + template + iterator + emplace_after(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert_after(__pos); + return { _Base::emplace_after(__pos.base(), + std::forward<_Args>(__args)...), + this }; + } + + iterator + insert_after(const_iterator __pos, const _Tp& __val) + { + __glibcxx_check_insert_after(__pos); + return { _Base::insert_after(__pos.base(), __val), this }; + } + + iterator + insert_after(const_iterator __pos, _Tp&& __val) + { + __glibcxx_check_insert_after(__pos); + return { _Base::insert_after(__pos.base(), std::move(__val)), this }; + } + + iterator + insert_after(const_iterator __pos, size_type __n, const _Tp& __val) + { + __glibcxx_check_insert_after(__pos); + return { _Base::insert_after(__pos.base(), __n, __val), this }; + } + + template> + iterator + insert_after(const_iterator __pos, + _InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_insert_range_after(__pos, __first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + return + { + _Base::insert_after(__pos.base(), + __gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)), + this + }; + else + return { _Base::insert_after(__pos.base(), __first, __last), this }; + } + + iterator + insert_after(const_iterator __pos, std::initializer_list<_Tp> __il) + { + __glibcxx_check_insert_after(__pos); + return { _Base::insert_after(__pos.base(), __il), this }; + } + + iterator + erase_after(const_iterator __pos) + { + __glibcxx_check_erase_after(__pos); + + _Base_const_iterator __next = std::next(__pos.base()); + this->_M_invalidate_if([__next](_Base_const_iterator __it) + { return __it == __next; }); + return { _Base::erase_after(__pos.base()), this }; + } + + iterator + erase_after(const_iterator __pos, const_iterator __last) + { + __glibcxx_check_erase_range_after(__pos, __last); + for (_Base_const_iterator __victim = std::next(__pos.base()); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(), + _M_message(__gnu_debug::__msg_valid_range2) + ._M_sequence(*this, "this") + ._M_iterator(__pos, "pos") + ._M_iterator(__last, "last")); + this->_M_invalidate_if([__victim](_Base_const_iterator __it) + { return __it == __victim; }); + } + + return { _Base::erase_after(__pos.base(), __last.base()), this }; + } + + void + swap(forward_list& __list) + noexcept( noexcept(declval<_Base&>().swap(__list)) ) + { + _Safe::_M_swap(__list); + _Base::swap(__list); + } + + void + resize(size_type __sz) + { + this->_M_detach_singular(); + + // if __sz < size(), invalidate all iterators in [begin+__sz, end() + _Base_iterator __victim = _Base::begin(); + _Base_iterator __end = _Base::end(); + for (size_type __i = __sz; __victim != __end && __i > 0; --__i) + ++__victim; + + for (; __victim != __end; ++__victim) + { + this->_M_invalidate_if([__victim](_Base_const_iterator __it) + { return __it == __victim; }); + } + + __try + { + _Base::resize(__sz); + } + __catch(...) + { + this->_M_revalidate_singular(); + __throw_exception_again; + } + } + + void + resize(size_type __sz, const value_type& __val) + { + this->_M_detach_singular(); + + // if __sz < size(), invalidate all iterators in [begin+__sz, end()) + _Base_iterator __victim = _Base::begin(); + _Base_iterator __end = _Base::end(); + for (size_type __i = __sz; __victim != __end && __i > 0; --__i) + ++__victim; + + for (; __victim != __end; ++__victim) + { + this->_M_invalidate_if([__victim](_Base_const_iterator __it) + { return __it == __victim; }); + } + + __try + { + _Base::resize(__sz, __val); + } + __catch(...) + { + this->_M_revalidate_singular(); + __throw_exception_again; + } + } + + void + clear() noexcept + { + _Base::clear(); + this->_M_invalidate_all(); + } + + // 23.2.3.5 forward_list operations: + void + splice_after(const_iterator __pos, forward_list&& __list) + { + __glibcxx_check_insert_after(__pos); + _GLIBCXX_DEBUG_VERIFY(std::__addressof(__list) != this, + _M_message(__gnu_debug::__msg_self_splice) + ._M_sequence(*this, "this")); + _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(), + _M_message(__gnu_debug::__msg_splice_alloc) + ._M_sequence(*this) + ._M_sequence(__list, "__list")); + this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it) + { + return __it != __list._M_base().cbefore_begin() + && __it != __list._M_base().end(); + }); + _Base::splice_after(__pos.base(), std::move(__list._M_base())); + } + + void + splice_after(const_iterator __pos, forward_list& __list) + { splice_after(__pos, std::move(__list)); } + + void + splice_after(const_iterator __pos, forward_list&& __list, + const_iterator __i) + { + __glibcxx_check_insert_after(__pos); + _GLIBCXX_DEBUG_VERIFY(__i._M_before_dereferenceable(), + _M_message(__gnu_debug::__msg_splice_bad) + ._M_iterator(__i, "__i")); + _GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(std::__addressof(__list)), + _M_message(__gnu_debug::__msg_splice_other) + ._M_iterator(__i, "__i") + ._M_sequence(__list, "__list")); + _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(), + _M_message(__gnu_debug::__msg_splice_alloc) + ._M_sequence(*this) + ._M_sequence(__list, "__list")); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 250. splicing invalidates iterators + _Base_const_iterator __next = std::next(__i.base()); + this->_M_transfer_from_if(__list, [__next](_Base_const_iterator __it) + { return __it == __next; }); + _Base::splice_after(__pos.base(), std::move(__list._M_base()), + __i.base()); + } + + void + splice_after(const_iterator __pos, forward_list& __list, + const_iterator __i) + { splice_after(__pos, std::move(__list), __i); } + + void + splice_after(const_iterator __pos, forward_list&& __list, + const_iterator __before, const_iterator __last) + { + typename __gnu_debug::_Distance_traits::__type __dist; + auto __listptr = std::__addressof(__list); + __glibcxx_check_insert_after(__pos); + __glibcxx_check_valid_fl_range(__before, __last, __dist); + _GLIBCXX_DEBUG_VERIFY(__before._M_attached_to(__listptr), + _M_message(__gnu_debug::__msg_splice_other) + ._M_sequence(__list, "list") + ._M_iterator(__before, "before")); + _GLIBCXX_DEBUG_VERIFY(__before._M_dereferenceable() + || __before._M_is_before_begin(), + _M_message(__gnu_debug::__msg_valid_range2) + ._M_sequence(__list, "list") + ._M_iterator(__before, "before") + ._M_iterator(__last, "last")); + _GLIBCXX_DEBUG_VERIFY(__before != __last, + _M_message(__gnu_debug::__msg_valid_range2) + ._M_sequence(__list, "list") + ._M_iterator(__before, "before") + ._M_iterator(__last, "last")); + _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(), + _M_message(__gnu_debug::__msg_splice_alloc) + ._M_sequence(*this) + ._M_sequence(__list, "__list")); + + for (_Base_const_iterator __tmp = std::next(__before.base()); + __tmp != __last.base(); ++__tmp) + { + _GLIBCXX_DEBUG_VERIFY(__tmp != __list._M_base().end(), + _M_message(__gnu_debug::__msg_valid_range2) + ._M_sequence(__list, "list") + ._M_iterator(__before, "before") + ._M_iterator(__last, "last")); + _GLIBCXX_DEBUG_VERIFY(__listptr != this || __tmp != __pos.base(), + _M_message(__gnu_debug::__msg_splice_overlap) + ._M_iterator(__tmp, "position") + ._M_iterator(__before, "before") + ._M_iterator(__last, "last")); + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 250. splicing invalidates iterators + this->_M_transfer_from_if(__list, [__tmp](_Base_const_iterator __it) + { return __it == __tmp; }); + } + + _Base::splice_after(__pos.base(), std::move(__list._M_base()), + __before.base(), __last.base()); + } + + void + splice_after(const_iterator __pos, forward_list& __list, + const_iterator __before, const_iterator __last) + { splice_after(__pos, std::move(__list), __before, __last); } + + private: +#if __cplusplus > 201703L + using __remove_return_type = size_type; +# define _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG \ + __attribute__((__abi_tag__("__cxx20"))) +# define _GLIBCXX20_ONLY(__expr) __expr +#else + using __remove_return_type = void; +# define _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG +# define _GLIBCXX20_ONLY(__expr) +#endif + + public: + _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG + __remove_return_type + remove(const _Tp& __val) + { + if (!this->_M_iterators && !this->_M_const_iterators) + return _Base::remove(__val); + + size_type __removed __attribute__((__unused__)) = 0; + _Base __to_destroy(get_allocator()); + _Base_const_iterator __x = _Base::cbefore_begin(); + _Base_const_iterator __old = __x++; + while (__x != _Base::cend()) + { + if (*__x == __val) + { + _Base_const_iterator __next = std::next(__old); + this->_M_invalidate_if([__next](_Base_const_iterator __it) + { return __it == __next; }); + __to_destroy.splice_after(__to_destroy.cbefore_begin(), + _M_base(), __old); + __x = __old; + _GLIBCXX20_ONLY( __removed++ ); + } + + __old = __x++; + } + + return _GLIBCXX20_ONLY( __removed ); + } + + template + __remove_return_type + remove_if(_Pred __pred) + { + if (!this->_M_iterators && !this->_M_const_iterators) + return _Base::remove_if(__pred); + + size_type __removed __attribute__((__unused__)) = 0; + _Base __to_destroy(get_allocator()); + _Base_iterator __x = _Base::before_begin(); + _Base_iterator __old = __x++; + while (__x != _Base::end()) + { + if (__pred(*__x)) + { + this->_M_invalidate_if([__x](_Base_const_iterator __it) + { return __it == __x; }); + __to_destroy.splice_after(__to_destroy.cbefore_begin(), + _M_base(), __old); + __x = __old; + _GLIBCXX20_ONLY( __removed++ ); + } + + __old = __x++; + } + + return _GLIBCXX20_ONLY( __removed ); + } + + _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG + __remove_return_type + unique() + { return unique(std::equal_to<_Tp>()); } + + template + __remove_return_type + unique(_BinPred __binary_pred) + { + if (!this->_M_iterators && !this->_M_const_iterators) + return _Base::unique(__binary_pred); + + _Base_const_iterator __first = _Base::cbegin(); + _Base_const_iterator __last = _Base::cend(); + if (__first == __last) + return _GLIBCXX20_ONLY(0); + + size_type __removed __attribute__((__unused__)) = 0; + _Base __to_destroy(get_allocator()); + _Base_const_iterator __next = std::next(__first); + while (__next != __last) + { + if (__binary_pred(*__first, *__next)) + { + this->_M_invalidate_if([__next](_Base_const_iterator __it) + { return __it == __next; }); + __to_destroy.splice_after(__to_destroy.cbefore_begin(), + _M_base(), __first); + __next = __first; + _GLIBCXX20_ONLY( __removed++ ); + } + + __first = __next++; + } + + return _GLIBCXX20_ONLY( __removed ); + } + +#undef _GLIBCXX_FWDLIST_REMOVE_RETURN_TYPE_TAG +#undef _GLIBCXX20_ONLY + + void + merge(forward_list&& __list) + { + if (this != std::__addressof(__list)) + { + __glibcxx_check_sorted(_Base::begin(), _Base::end()); + __glibcxx_check_sorted(__list._M_base().begin(), + __list._M_base().end()); + this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it) + { + return __it != __list._M_base().cbefore_begin() + && __it != __list._M_base().cend(); + }); + _Base::merge(std::move(__list._M_base())); + } + } + + void + merge(forward_list& __list) + { merge(std::move(__list)); } + + template + void + merge(forward_list&& __list, _Comp __comp) + { + if (this != std::__addressof(__list)) + { + __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), __comp); + __glibcxx_check_sorted_pred(__list._M_base().begin(), + __list._M_base().end(), __comp); + this->_M_transfer_from_if(__list, + [&__list](_Base_const_iterator __it) + { + return __it != __list._M_base().cbefore_begin() + && __it != __list._M_base().cend(); + }); + _Base::merge(std::move(__list._M_base()), __comp); + } + } + + template + void + merge(forward_list& __list, _Comp __comp) + { merge(std::move(__list), __comp); } + + using _Base::sort; + using _Base::reverse; + + _Base& + _M_base() noexcept { return *this; } + + const _Base& + _M_base() const noexcept { return *this; } + }; + +#if __cpp_deduction_guides >= 201606 + template::value_type, + typename _Allocator = allocator<_ValT>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireAllocator<_Allocator>> + forward_list(_InputIterator, _InputIterator, _Allocator = _Allocator()) + -> forward_list<_ValT, _Allocator>; +#endif + + template + bool + operator==(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return __lx._M_base() == __ly._M_base(); } + +#if __cpp_lib_three_way_comparison + template + constexpr __detail::__synth3way_t<_Tp> + operator<=>(const forward_list<_Tp, _Alloc>& __x, + const forward_list<_Tp, _Alloc>& __y) + { return __x._M_base() <=> __y._M_base(); } +#else + template + inline bool + operator<(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return __lx._M_base() < __ly._M_base(); } + + template + inline bool + operator!=(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return !(__lx == __ly); } + + /// Based on operator< + template + inline bool + operator>(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return (__ly < __lx); } + + /// Based on operator< + template + inline bool + operator>=(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return !(__lx < __ly); } + + /// Based on operator< + template + inline bool + operator<=(const forward_list<_Tp, _Alloc>& __lx, + const forward_list<_Tp, _Alloc>& __ly) + { return !(__ly < __lx); } +#endif // three-way comparison + + /// See std::forward_list::swap(). + template + inline void + swap(forward_list<_Tp, _Alloc>& __lx, forward_list<_Tp, _Alloc>& __ly) + noexcept(noexcept(__lx.swap(__ly))) + { __lx.swap(__ly); } + +} // namespace __debug +} // namespace std + +namespace __gnu_debug +{ + template + struct _BeforeBeginHelper > + { + typedef std::__debug::forward_list<_Tp, _Alloc> _Sequence; + + template + static bool + _S_Is(const _Safe_iterator<_Iterator, _Sequence>& __it) + { + return + __it.base() == __it._M_get_sequence()->_M_base().before_begin(); + } + + template + static bool + _S_Is_Beginnest(const _Safe_iterator<_Iterator, _Sequence>& __it) + { return _S_Is(__it); } + }; + + template + struct _Sequence_traits > + { + typedef typename std::__debug::forward_list<_Tp, _Alloc>::iterator _It; + + static typename _Distance_traits<_It>::__type + _S_size(const std::__debug::forward_list<_Tp, _Alloc>& __seq) + { + return __seq.empty() + ? std::make_pair(0, __dp_exact) : std::make_pair(1, __dp_sign); + } + }; + +#ifndef _GLIBCXX_DEBUG_PEDANTIC + template + struct _Insert_range_from_self_is_safe< + std::__debug::forward_list<_Tp, _Alloc> > + { enum { __value = 1 }; }; +#endif +} + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/functions.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/functions.h new file mode 100644 index 0000000..6cac11f --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/functions.h @@ -0,0 +1,470 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/functions.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_FUNCTIONS_H +#define _GLIBCXX_DEBUG_FUNCTIONS_H 1 + +#include // for less + +#if __cplusplus >= 201103L +# include // for __miter_base +# include // for is_lvalue_reference and conditional. +#endif + +#include +#include + +namespace __gnu_debug +{ + template + struct _Insert_range_from_self_is_safe + { enum { __value = 0 }; }; + + template + struct _Is_contiguous_sequence : std::__false_type { }; + + /* Checks that [first, last) is a valid range, and then returns + * __first. This routine is useful when we can't use a separate + * assertion statement because, e.g., we are in a constructor. + */ + template + inline _InputIterator + __check_valid_range(const _InputIterator& __first, + const _InputIterator& __last, + const char* __file, + unsigned int __line, + const char* __function) + { + __glibcxx_check_valid_range_at(__first, __last, + __file, __line, __function); + return __first; + } + + /* Handle the case where __other is a pointer to _Sequence::value_type. */ + template + inline bool + __foreign_iterator_aux4( + const _Safe_iterator<_Iterator, _Sequence, _Category>& __it, + const typename _Sequence::value_type* __other) + { + typedef const typename _Sequence::value_type* _PointerType; + typedef std::less<_PointerType> _Less; +#if __cplusplus >= 201103L + constexpr _Less __l{}; +#else + const _Less __l = _Less(); +#endif + const _Sequence* __seq = __it._M_get_sequence(); + const _PointerType __begin = std::__addressof(*__seq->_M_base().begin()); + const _PointerType __end = std::__addressof(*(__seq->_M_base().end()-1)); + + // Check whether __other points within the contiguous storage. + return __l(__other, __begin) || __l(__end, __other); + } + + /* Fallback overload for when we can't tell, assume it is valid. */ + template + inline bool + __foreign_iterator_aux4( + const _Safe_iterator<_Iterator, _Sequence, _Category>&, ...) + { return true; } + + /* Handle sequences with contiguous storage */ + template + inline bool + __foreign_iterator_aux3( + const _Safe_iterator<_Iterator, _Sequence, _Category>& __it, + const _InputIterator& __other, const _InputIterator& __other_end, + std::__true_type) + { + if (__other == __other_end) + return true; // inserting nothing is safe even if not foreign iters + if (__it._M_get_sequence()->empty()) + return true; // can't be self-inserting if self is empty + return __foreign_iterator_aux4(__it, std::__addressof(*__other)); + } + + /* Handle non-contiguous containers, assume it is valid. */ + template + inline bool + __foreign_iterator_aux3( + const _Safe_iterator<_Iterator, _Sequence, _Category>&, + const _InputIterator&, const _InputIterator&, + std::__false_type) + { return true; } + + /** Handle debug iterators from the same type of container. */ + template + inline bool + __foreign_iterator_aux2( + const _Safe_iterator<_Iterator, _Sequence, _Category>& __it, + const _Safe_iterator<_OtherIterator, _Sequence, _Category>& __other, + const _Safe_iterator<_OtherIterator, _Sequence, _Category>&) + { return __it._M_get_sequence() != __other._M_get_sequence(); } + + /** Handle debug iterators from different types of container. */ + template + inline bool + __foreign_iterator_aux2( + const _Safe_iterator<_Iterator, _Sequence, _Category>&, + const _Safe_iterator<_OtherIterator, _OtherSequence, + _OtherCategory>&, + const _Safe_iterator<_OtherIterator, _OtherSequence, + _OtherCategory>&) + { return true; } + + /* Handle non-debug iterators. */ + template + inline bool + __foreign_iterator_aux2( + const _Safe_iterator<_Iterator, _Sequence, _Category>& __it, + const _InputIterator& __other, + const _InputIterator& __other_end) + { +#if __cplusplus < 201103L + typedef _Is_contiguous_sequence<_Sequence> __tag; +#else + using __lvalref = std::is_lvalue_reference< + typename std::iterator_traits<_InputIterator>::reference>; + using __contiguous = _Is_contiguous_sequence<_Sequence>; + using __tag = typename std::conditional<__lvalref::value, __contiguous, + std::__false_type>::type; +#endif + return __foreign_iterator_aux3(__it, __other, __other_end, __tag()); + } + + /* Handle the case where we aren't really inserting a range after all */ + template + inline bool + __foreign_iterator_aux( + const _Safe_iterator<_Iterator, _Sequence, _Category>&, + _Integral, _Integral, std::__true_type) + { return true; } + + /* Handle all iterators. */ + template + inline bool + __foreign_iterator_aux( + const _Safe_iterator<_Iterator, _Sequence, _Category>& __it, + _InputIterator __other, _InputIterator __other_end, + std::__false_type) + { + return _Insert_range_from_self_is_safe<_Sequence>::__value + || __foreign_iterator_aux2(__it, std::__miter_base(__other), + std::__miter_base(__other_end)); + } + + template + inline bool + __foreign_iterator( + const _Safe_iterator<_Iterator, _Sequence, _Category>& __it, + _InputIterator __other, _InputIterator __other_end) + { + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + return __foreign_iterator_aux(__it, __other, __other_end, _Integral()); + } + + // Can't check if an input iterator sequence is sorted, because we + // can't step through the sequence. + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted_aux(const _InputIterator&, const _InputIterator&, + std::input_iterator_tag) + { return true; } + + // Can verify if a forward iterator sequence is in fact sorted using + // std::__is_sorted + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last, + std::forward_iterator_tag) + { + if (__first == __last) + return true; + + _ForwardIterator __next = __first; + for (++__next; __next != __last; __first = __next, (void)++__next) + if (*__next < *__first) + return false; + + return true; + } + + // Can't check if an input iterator sequence is sorted, because we can't step + // through the sequence. + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted_aux(const _InputIterator&, const _InputIterator&, + _Predicate, std::input_iterator_tag) + { return true; } + + // Can verify if a forward iterator sequence is in fact sorted using + // std::__is_sorted + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted_aux(_ForwardIterator __first, _ForwardIterator __last, + _Predicate __pred, std::forward_iterator_tag) + { + if (__first == __last) + return true; + + _ForwardIterator __next = __first; + for (++__next; __next != __last; __first = __next, (void)++__next) + if (__pred(*__next, *__first)) + return false; + + return true; + } + + // Determine if a sequence is sorted. + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted(const _InputIterator& __first, const _InputIterator& __last) + { + return __check_sorted_aux(__first, __last, + std::__iterator_category(__first)); + } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted(const _InputIterator& __first, const _InputIterator& __last, + _Predicate __pred) + { + return __check_sorted_aux(__first, __last, __pred, + std::__iterator_category(__first)); + } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted_set_aux(const _InputIterator& __first, + const _InputIterator& __last, + std::__true_type) + { return __check_sorted(__first, __last); } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted_set_aux(const _InputIterator&, + const _InputIterator&, + std::__false_type) + { return true; } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted_set_aux(const _InputIterator& __first, + const _InputIterator& __last, + _Predicate __pred, std::__true_type) + { return __check_sorted(__first, __last, __pred); } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted_set_aux(const _InputIterator&, + const _InputIterator&, _Predicate, + std::__false_type) + { return true; } + + // ... special variant used in std::merge, std::includes, std::set_*. + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted_set(const _InputIterator1& __first, + const _InputIterator1& __last, + const _InputIterator2&) + { + typedef typename std::iterator_traits<_InputIterator1>::value_type + _ValueType1; + typedef typename std::iterator_traits<_InputIterator2>::value_type + _ValueType2; + + typedef typename std::__are_same<_ValueType1, _ValueType2>::__type + _SameType; + return __check_sorted_set_aux(__first, __last, _SameType()); + } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_sorted_set(const _InputIterator1& __first, + const _InputIterator1& __last, + const _InputIterator2&, _Predicate __pred) + { + typedef typename std::iterator_traits<_InputIterator1>::value_type + _ValueType1; + typedef typename std::iterator_traits<_InputIterator2>::value_type + _ValueType2; + + typedef typename std::__are_same<_ValueType1, _ValueType2>::__type + _SameType; + return __check_sorted_set_aux(__first, __last, __pred, _SameType()); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 270. Binary search requirements overly strict + // Determine if a sequence is partitioned w.r.t. this element. + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_partitioned_lower(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value) + { + while (__first != __last && *__first < __value) + ++__first; + if (__first != __last) + { + ++__first; + while (__first != __last && !(*__first < __value)) + ++__first; + } + return __first == __last; + } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_partitioned_upper(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value) + { + while (__first != __last && !(__value < *__first)) + ++__first; + if (__first != __last) + { + ++__first; + while (__first != __last && __value < *__first) + ++__first; + } + return __first == __last; + } + + // Determine if a sequence is partitioned w.r.t. this element. + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_partitioned_lower(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value, + _Pred __pred) + { + while (__first != __last && bool(__pred(*__first, __value))) + ++__first; + if (__first != __last) + { + ++__first; + while (__first != __last && !bool(__pred(*__first, __value))) + ++__first; + } + return __first == __last; + } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __check_partitioned_upper(_ForwardIterator __first, + _ForwardIterator __last, const _Tp& __value, + _Pred __pred) + { + while (__first != __last && !bool(__pred(__value, *__first))) + ++__first; + if (__first != __last) + { + ++__first; + while (__first != __last && bool(__pred(__value, *__first))) + ++__first; + } + return __first == __last; + } + +#if __cplusplus >= 201103L + struct _Irreflexive_checker + { + template + static typename std::iterator_traits<_It>::reference + __ref(); + + template() < __ref<_It>())> + _GLIBCXX20_CONSTEXPR + static bool + _S_is_valid(_It __it) + { return !(*__it < *__it); } + + // Fallback method if operator doesn't exist. + template + _GLIBCXX20_CONSTEXPR + static bool + _S_is_valid(_Args...) + { return true; } + + template()(__ref<_It>(), __ref<_It>()))> + _GLIBCXX20_CONSTEXPR + static bool + _S_is_valid_pred(_It __it, _Pred __pred) + { return !__pred(*__it, *__it); } + + // Fallback method if predicate can't be invoked. + template + _GLIBCXX20_CONSTEXPR + static bool + _S_is_valid_pred(_Args...) + { return true; } + }; + + template + _GLIBCXX20_CONSTEXPR + inline bool + __is_irreflexive(_Iterator __it) + { return _Irreflexive_checker::_S_is_valid(__it); } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __is_irreflexive_pred(_Iterator __it, _Pred __pred) + { return _Irreflexive_checker::_S_is_valid_pred(__it, __pred); } +#endif + +} // namespace __gnu_debug + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/helper_functions.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/helper_functions.h new file mode 100644 index 0000000..c0144ce --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/helper_functions.h @@ -0,0 +1,331 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/helper_functions.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_HELPER_FUNCTIONS_H +#define _GLIBCXX_DEBUG_HELPER_FUNCTIONS_H 1 + +#include // for __addressof +#include // for iterator_traits, + // categories and _Iter_base +#include // for __is_integer + +#include // for pair + +namespace __gnu_debug +{ + template + class _Safe_iterator; + +#if __cplusplus >= 201103L + template + class _Safe_local_iterator; +#endif + + /** The precision to which we can calculate the distance between + * two iterators. + */ + enum _Distance_precision + { + __dp_none, // Not even an iterator type + __dp_equality, //< Can compare iterator equality, only + __dp_sign, //< Can determine equality and ordering + __dp_sign_max_size, //< __dp_sign and gives max range size + __dp_exact //< Can determine distance precisely + }; + + template::__type> + struct _Distance_traits + { + private: + typedef + typename std::iterator_traits<_Iterator>::difference_type _ItDiffType; + + template::__type> + struct _DiffTraits + { typedef _DiffType __type; }; + + template + struct _DiffTraits<_DiffType, std::__true_type> + { typedef std::ptrdiff_t __type; }; + + typedef typename _DiffTraits<_ItDiffType>::__type _DiffType; + + public: + typedef std::pair<_DiffType, _Distance_precision> __type; + }; + + template + struct _Distance_traits<_Integral, std::__true_type> + { typedef std::pair __type; }; + + /** Determine the distance between two iterators with some known + * precision. + */ + template + _GLIBCXX_CONSTEXPR + inline typename _Distance_traits<_Iterator>::__type + __get_distance(_Iterator __lhs, _Iterator __rhs, + std::random_access_iterator_tag) + { return std::make_pair(__rhs - __lhs, __dp_exact); } + + template + _GLIBCXX14_CONSTEXPR + inline typename _Distance_traits<_Iterator>::__type + __get_distance(_Iterator __lhs, _Iterator __rhs, + std::input_iterator_tag) + { + if (__lhs == __rhs) + return std::make_pair(0, __dp_exact); + + return std::make_pair(1, __dp_equality); + } + + template + _GLIBCXX_CONSTEXPR + inline typename _Distance_traits<_Iterator>::__type + __get_distance(_Iterator __lhs, _Iterator __rhs) + { return __get_distance(__lhs, __rhs, std::__iterator_category(__lhs)); } + + // An arbitrary iterator pointer is not singular. + inline bool + __check_singular_aux(const void*) { return false; } + + // We may have an iterator that derives from _Safe_iterator_base but isn't + // a _Safe_iterator. + template + _GLIBCXX_CONSTEXPR + inline bool + __check_singular(_Iterator const& __x) + { + return +#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED + __builtin_is_constant_evaluated() ? false : +#endif + __check_singular_aux(std::__addressof(__x)); + } + + /** Non-NULL pointers are nonsingular. */ + template + _GLIBCXX_CONSTEXPR + inline bool + __check_singular(_Tp* const& __ptr) + { + return +#ifdef _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED + __builtin_is_constant_evaluated() ? false : +#endif + __ptr == 0; + } + + /** We say that integral types for a valid range, and defer to other + * routines to realize what to do with integral types instead of + * iterators. + */ + template + _GLIBCXX_CONSTEXPR + inline bool + __valid_range_aux(_Integral, _Integral, std::__true_type) + { return true; } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __valid_range_aux(_Integral, _Integral, + typename _Distance_traits<_Integral>::__type& __dist, + std::__true_type) + { + __dist = std::make_pair(0, __dp_none); + return true; + } + + template + _GLIBCXX_CONSTEXPR + inline bool + __valid_range_aux(_InputIterator __first, _InputIterator __last, + std::input_iterator_tag) + { + return __first == __last + || (!__check_singular(__first) && !__check_singular(__last)); + } + + template + _GLIBCXX_CONSTEXPR + inline bool + __valid_range_aux(_InputIterator __first, _InputIterator __last, + std::random_access_iterator_tag) + { + return + __valid_range_aux(__first, __last, std::input_iterator_tag()) + && __first <= __last; + } + + /** We have iterators, so figure out what kind of iterators they are + * to see if we can check the range ahead of time. + */ + template + _GLIBCXX_CONSTEXPR + inline bool + __valid_range_aux(_InputIterator __first, _InputIterator __last, + std::__false_type) + { + return __valid_range_aux(__first, __last, + std::__iterator_category(__first)); + } + + template + _GLIBCXX20_CONSTEXPR + inline bool + __valid_range_aux(_InputIterator __first, _InputIterator __last, + typename _Distance_traits<_InputIterator>::__type& __dist, + std::__false_type) + { + if (!__valid_range_aux(__first, __last, std::input_iterator_tag())) + return false; + + __dist = __get_distance(__first, __last); + switch (__dist.second) + { + case __dp_none: + break; + case __dp_equality: + if (__dist.first == 0) + return true; + break; + case __dp_sign: + case __dp_sign_max_size: + case __dp_exact: + return __dist.first >= 0; + } + + // Can't tell so assume it is fine. + return true; + } + + /** Don't know what these iterators are, or if they are even + * iterators (we may get an integral type for InputIterator), so + * see if they are integral and pass them on to the next phase + * otherwise. + */ + template + _GLIBCXX20_CONSTEXPR + inline bool + __valid_range(_InputIterator __first, _InputIterator __last, + typename _Distance_traits<_InputIterator>::__type& __dist) + { + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + return __valid_range_aux(__first, __last, __dist, _Integral()); + } + + template + bool + __valid_range(const _Safe_iterator<_Iterator, _Sequence, _Category>&, + const _Safe_iterator<_Iterator, _Sequence, _Category>&, + typename _Distance_traits<_Iterator>::__type&); + +#if __cplusplus >= 201103L + template + bool + __valid_range(const _Safe_local_iterator<_Iterator, _Sequence>&, + const _Safe_local_iterator<_Iterator, _Sequence>&, + typename _Distance_traits<_Iterator>::__type&); +#endif + + template + _GLIBCXX14_CONSTEXPR + inline bool + __valid_range(_InputIterator __first, _InputIterator __last) + { + typedef typename std::__is_integer<_InputIterator>::__type _Integral; + return __valid_range_aux(__first, __last, _Integral()); + } + + template + bool + __valid_range(const _Safe_iterator<_Iterator, _Sequence, _Category>&, + const _Safe_iterator<_Iterator, _Sequence, _Category>&); + +#if __cplusplus >= 201103L + template + bool + __valid_range(const _Safe_local_iterator<_Iterator, _Sequence>&, + const _Safe_local_iterator<_Iterator, _Sequence>&); +#endif + + // Fallback method, always ok. + template + _GLIBCXX_CONSTEXPR + inline bool + __can_advance(_InputIterator, _Size) + { return true; } + + template + bool + __can_advance(const _Safe_iterator<_Iterator, _Sequence, _Category>&, + _Size); + + template + _GLIBCXX_CONSTEXPR + inline bool + __can_advance(_InputIterator, const std::pair<_Diff, _Distance_precision>&, int) + { return true; } + + template + bool + __can_advance(const _Safe_iterator<_Iterator, _Sequence, _Category>&, + const std::pair<_Diff, _Distance_precision>&, int); + + /** Helper function to extract base iterator of random access safe iterator + * in order to reduce performance impact of debug mode. Limited to random + * access iterator because it is the only category for which it is possible + * to check for correct iterators order in the __valid_range function + * thanks to the < operator. + */ + template + _GLIBCXX_CONSTEXPR + inline _Iterator + __base(_Iterator __it) + { return __it; } + +#if __cplusplus < 201103L + template + struct _Unsafe_type + { typedef _Iterator _Type; }; +#endif + + /* Remove debug mode safe iterator layer, if any. */ + template + inline _Iterator + __unsafe(_Iterator __it) + { return __it; } +} + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/list b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/list new file mode 100644 index 0000000..01fe43f --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/list @@ -0,0 +1,987 @@ +// Debugging list implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/list + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_LIST +#define _GLIBCXX_DEBUG_LIST 1 + +#pragma GCC system_header + +#include +namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { + template class list; +} } // namespace std::__debug + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::list with safety/checking/debug instrumentation. + template > + class list + : public __gnu_debug::_Safe_container< + list<_Tp, _Allocator>, _Allocator, + __gnu_debug::_Safe_node_sequence>, + public _GLIBCXX_STD_C::list<_Tp, _Allocator> + { + typedef _GLIBCXX_STD_C::list<_Tp, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + list, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; + + typedef typename _Base::iterator _Base_iterator; + typedef typename _Base::const_iterator _Base_const_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; + + template + friend class ::__gnu_debug::_Safe_iterator; + + // Reference wrapper for base class. Disambiguates list(const _Base&) + // from copy constructor by requiring a user-defined conversion. + // See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator<_Base_iterator, list> + iterator; + typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, list> + const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + + typedef _Tp value_type; + typedef _Allocator allocator_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.2.2.1 construct/copy/destroy: + +#if __cplusplus < 201103L + list() + : _Base() { } + + list(const list& __x) + : _Base(__x) { } + + ~list() { } +#else + list() = default; + list(const list&) = default; + list(list&&) = default; + + list(initializer_list __l, + const allocator_type& __a = allocator_type()) + : _Base(__l, __a) { } + + ~list() = default; + + list(const list& __x, const allocator_type& __a) + : _Base(__x, __a) { } + + list(list&& __x, const allocator_type& __a) + noexcept( + std::is_nothrow_constructible<_Base, + _Base, const allocator_type&>::value ) + : _Safe(std::move(__x._M_safe()), __a), + _Base(std::move(__x._M_base()), __a) { } +#endif + + explicit + list(const _Allocator& __a) _GLIBCXX_NOEXCEPT + : _Base(__a) { } + +#if __cplusplus >= 201103L + explicit + list(size_type __n, const allocator_type& __a = allocator_type()) + : _Base(__n, __a) { } + + list(size_type __n, const _Tp& __value, + const _Allocator& __a = _Allocator()) + : _Base(__n, __value, __a) { } +#else + explicit + list(size_type __n, const _Tp& __value = _Tp(), + const _Allocator& __a = _Allocator()) + : _Base(__n, __value, __a) { } +#endif + +#if __cplusplus >= 201103L + template> +#else + template +#endif + list(_InputIterator __first, _InputIterator __last, + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __a) + { } + + list(_Base_ref __x) + : _Base(__x._M_ref) { } + +#if __cplusplus < 201103L + list& + operator=(const list& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + return *this; + } +#else + list& + operator=(const list&) = default; + + list& + operator=(list&&) = default; + + list& + operator=(initializer_list __l) + { + this->_M_invalidate_all(); + _M_base() = __l; + return *this; + } + + void + assign(initializer_list __l) + { + _Base::assign(__l); + this->_M_invalidate_all(); + } +#endif + +#if __cplusplus >= 201103L + template> +#else + template +#endif + void + assign(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::assign(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::assign(__first, __last); + + this->_M_invalidate_all(); + } + + void + assign(size_type __n, const _Tp& __t) + { + _Base::assign(__n, __t); + this->_M_invalidate_all(); + } + + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // 23.2.2.2 capacity: + using _Base::empty; + using _Base::size; + using _Base::max_size; + +#if __cplusplus >= 201103L + void + resize(size_type __sz) + { + this->_M_detach_singular(); + + // if __sz < size(), invalidate all iterators in [begin + __sz, end()) + _Base_iterator __victim = _Base::begin(); + _Base_iterator __end = _Base::end(); + for (size_type __i = __sz; __victim != __end && __i > 0; --__i) + ++__victim; + + for (; __victim != __end; ++__victim) + this->_M_invalidate_if(_Equal(__victim)); + + __try + { + _Base::resize(__sz); + } + __catch(...) + { + this->_M_revalidate_singular(); + __throw_exception_again; + } + } + + void + resize(size_type __sz, const _Tp& __c) + { + this->_M_detach_singular(); + + // if __sz < size(), invalidate all iterators in [begin + __sz, end()) + _Base_iterator __victim = _Base::begin(); + _Base_iterator __end = _Base::end(); + for (size_type __i = __sz; __victim != __end && __i > 0; --__i) + ++__victim; + + for (; __victim != __end; ++__victim) + this->_M_invalidate_if(_Equal(__victim)); + + __try + { + _Base::resize(__sz, __c); + } + __catch(...) + { + this->_M_revalidate_singular(); + __throw_exception_again; + } + } +#else + void + resize(size_type __sz, _Tp __c = _Tp()) + { + this->_M_detach_singular(); + + // if __sz < size(), invalidate all iterators in [begin + __sz, end()) + _Base_iterator __victim = _Base::begin(); + _Base_iterator __end = _Base::end(); + for (size_type __i = __sz; __victim != __end && __i > 0; --__i) + ++__victim; + + for (; __victim != __end; ++__victim) + this->_M_invalidate_if(_Equal(__victim)); + + __try + { + _Base::resize(__sz, __c); + } + __catch(...) + { + this->_M_revalidate_singular(); + __throw_exception_again; + } + } +#endif + + // element access: + reference + front() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::front(); + } + + const_reference + front() const _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::front(); + } + + reference + back() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::back(); + } + + const_reference + back() const _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::back(); + } + + // 23.2.2.3 modifiers: + using _Base::push_front; + +#if __cplusplus >= 201103L + using _Base::emplace_front; +#endif + + void + pop_front() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + this->_M_invalidate_if(_Equal(_Base::begin())); + _Base::pop_front(); + } + + using _Base::push_back; + +#if __cplusplus >= 201103L + using _Base::emplace_back; +#endif + + void + pop_back() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + this->_M_invalidate_if(_Equal(--_Base::end())); + _Base::pop_back(); + } + +#if __cplusplus >= 201103L + template + iterator + emplace(const_iterator __position, _Args&&... __args) + { + __glibcxx_check_insert(__position); + return { _Base::emplace(__position.base(), + std::forward<_Args>(__args)...), this }; + } +#endif + + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const _Tp& __x) +#else + insert(iterator __position, const _Tp& __x) +#endif + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), __x), this); + } + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, _Tp&& __x) + { return emplace(__position, std::move(__x)); } + + iterator + insert(const_iterator __p, initializer_list __l) + { + __glibcxx_check_insert(__p); + return { _Base::insert(__p.base(), __l), this }; + } +#endif + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, size_type __n, const _Tp& __x) + { + __glibcxx_check_insert(__position); + return { _Base::insert(__position.base(), __n, __x), this }; + } +#else + void + insert(iterator __position, size_type __n, const _Tp& __x) + { + __glibcxx_check_insert(__position); + _Base::insert(__position.base(), __n, __x); + } +#endif + +#if __cplusplus >= 201103L + template> + iterator + insert(const_iterator __position, _InputIterator __first, + _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_insert_range(__position, __first, __last, __dist); + if (__dist.second >= __gnu_debug::__dp_sign) + return + { + _Base::insert(__position.base(), + __gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)), + this + }; + else + return { _Base::insert(__position.base(), __first, __last), this }; + } +#else + template + void + insert(iterator __position, _InputIterator __first, + _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_insert_range(__position, __first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__position.base(), __gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__position.base(), __first, __last); + } +#endif + + private: + _Base_iterator +#if __cplusplus >= 201103L + _M_erase(_Base_const_iterator __position) noexcept +#else + _M_erase(_Base_iterator __position) +#endif + { + this->_M_invalidate_if(_Equal(__position)); + return _Base::erase(__position); + } + + public: + iterator +#if __cplusplus >= 201103L + erase(const_iterator __position) noexcept +#else + erase(iterator __position) +#endif + { + __glibcxx_check_erase(__position); + return iterator(_M_erase(__position.base()), this); + } + + iterator +#if __cplusplus >= 201103L + erase(const_iterator __first, const_iterator __last) noexcept +#else + erase(iterator __first, iterator __last) +#endif + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_const_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "position") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + + return iterator(_Base::erase(__first.base(), __last.base()), this); + } + + void + swap(list& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + _Base::clear(); + this->_M_invalidate_all(); + } + + // 23.2.2.4 list operations: + void +#if __cplusplus >= 201103L + splice(const_iterator __position, list&& __x) noexcept +#else + splice(iterator __position, list& __x) +#endif + { + _GLIBCXX_DEBUG_VERIFY(std::__addressof(__x) != this, + _M_message(__gnu_debug::__msg_self_splice) + ._M_sequence(*this, "this")); + this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end())); + _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base())); + } + +#if __cplusplus >= 201103L + void + splice(const_iterator __position, list& __x) noexcept + { splice(__position, std::move(__x)); } +#endif + + void +#if __cplusplus >= 201103L + splice(const_iterator __position, list&& __x, const_iterator __i) noexcept +#else + splice(iterator __position, list& __x, iterator __i) +#endif + { + __glibcxx_check_insert(__position); + + // We used to perform the splice_alloc check: not anymore, redundant + // after implementing the relevant bits of N1599. + + _GLIBCXX_DEBUG_VERIFY(__i._M_dereferenceable(), + _M_message(__gnu_debug::__msg_splice_bad) + ._M_iterator(__i, "__i")); + _GLIBCXX_DEBUG_VERIFY(__i._M_attached_to(std::__addressof(__x)), + _M_message(__gnu_debug::__msg_splice_other) + ._M_iterator(__i, "__i")._M_sequence(__x, "__x")); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 250. splicing invalidates iterators + this->_M_transfer_from_if(__x, _Equal(__i.base())); + _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()), + __i.base()); + } + +#if __cplusplus >= 201103L + void + splice(const_iterator __position, list& __x, const_iterator __i) noexcept + { splice(__position, std::move(__x), __i); } +#endif + + void +#if __cplusplus >= 201103L + splice(const_iterator __position, list&& __x, const_iterator __first, + const_iterator __last) noexcept +#else + splice(iterator __position, list& __x, iterator __first, + iterator __last) +#endif + { + __glibcxx_check_insert(__position); + __glibcxx_check_valid_range(__first, __last); + _GLIBCXX_DEBUG_VERIFY(__first._M_attached_to(std::__addressof(__x)), + _M_message(__gnu_debug::__msg_splice_other) + ._M_sequence(__x, "x") + ._M_iterator(__first, "first")); + + // We used to perform the splice_alloc check: not anymore, redundant + // after implementing the relevant bits of N1599. + + for (_Base_const_iterator __tmp = __first.base(); + __tmp != __last.base(); ++__tmp) + { + _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + _GLIBCXX_DEBUG_VERIFY(std::__addressof(__x) != this + || __tmp != __position.base(), + _M_message(__gnu_debug::__msg_splice_overlap) + ._M_iterator(__tmp, "position") + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 250. splicing invalidates iterators + this->_M_transfer_from_if(__x, _Equal(__tmp)); + } + + _Base::splice(__position.base(), _GLIBCXX_MOVE(__x._M_base()), + __first.base(), __last.base()); + } + +#if __cplusplus >= 201103L + void + splice(const_iterator __position, list& __x, + const_iterator __first, const_iterator __last) noexcept + { splice(__position, std::move(__x), __first, __last); } +#endif + + private: +#if __cplusplus > 201703L + typedef size_type __remove_return_type; +# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG \ + __attribute__((__abi_tag__("__cxx20"))) +# define _GLIBCXX20_ONLY(__expr) __expr +#else + typedef void __remove_return_type; +# define _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG +# define _GLIBCXX20_ONLY(__expr) +#endif + + public: + _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG + __remove_return_type + remove(const _Tp& __value) + { + if (!this->_M_iterators && !this->_M_const_iterators) + return _Base::remove(__value); + +#if !_GLIBCXX_USE_CXX11_ABI + size_type __removed __attribute__((__unused__)) = 0; +#endif + _Base __to_destroy(get_allocator()); + _Base_iterator __first = _Base::begin(); + _Base_iterator __last = _Base::end(); + while (__first != __last) + { + _Base_iterator __next = __first; + ++__next; + if (*__first == __value) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 526. Is it undefined if a function in the standard changes + // in parameters? + this->_M_invalidate_if(_Equal(__first)); + __to_destroy.splice(__to_destroy.begin(), _M_base(), __first); +#if !_GLIBCXX_USE_CXX11_ABI + _GLIBCXX20_ONLY( __removed++ ); +#endif + } + + __first = __next; + } + +#if !_GLIBCXX_USE_CXX11_ABI + return _GLIBCXX20_ONLY( __removed ); +#else + return _GLIBCXX20_ONLY( __to_destroy.size() ); +#endif + } + + template + __remove_return_type + remove_if(_Predicate __pred) + { + if (!this->_M_iterators && !this->_M_const_iterators) + return _Base::remove_if(__pred); + +#if !_GLIBCXX_USE_CXX11_ABI + size_type __removed __attribute__((__unused__)) = 0; +#endif + _Base __to_destroy(get_allocator()); + for (_Base_iterator __x = _Base::begin(); __x != _Base::end(); ) + { + _Base_iterator __next = __x; + ++__next; + if (__pred(*__x)) + { + this->_M_invalidate_if(_Equal(__x)); + __to_destroy.splice(__to_destroy.begin(), _M_base(), __x); +#if !_GLIBCXX_USE_CXX11_ABI + _GLIBCXX20_ONLY( __removed++ ); +#endif + } + + __x = __next; + } + +#if !_GLIBCXX_USE_CXX11_ABI + return _GLIBCXX20_ONLY( __removed ); +#else + return _GLIBCXX20_ONLY( __to_destroy.size() ); +#endif + } + + _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG + __remove_return_type + unique() + { + if (!this->_M_iterators && !this->_M_const_iterators) + return _Base::unique(); + + if (empty()) + return _GLIBCXX20_ONLY(0); + +#if !_GLIBCXX_USE_CXX11_ABI + size_type __removed __attribute__((__unused__)) = 0; +#endif + _Base __to_destroy(get_allocator()); + _Base_iterator __first = _Base::begin(); + _Base_iterator __last = _Base::end(); + _Base_iterator __next = __first; + while (++__next != __last) + if (*__first == *__next) + { + this->_M_invalidate_if(_Equal(__next)); + __to_destroy.splice(__to_destroy.begin(), _M_base(), __next); + __next = __first; +#if !_GLIBCXX_USE_CXX11_ABI + _GLIBCXX20_ONLY( __removed++ ); +#endif + } + else + __first = __next; + +#if !_GLIBCXX_USE_CXX11_ABI + return _GLIBCXX20_ONLY( __removed ); +#else + return _GLIBCXX20_ONLY( __to_destroy.size() ); +#endif + } + + template + __remove_return_type + unique(_BinaryPredicate __binary_pred) + { + if (!this->_M_iterators && !this->_M_const_iterators) + return _Base::unique(__binary_pred); + + if (empty()) + return _GLIBCXX20_ONLY(0); + + +#if !_GLIBCXX_USE_CXX11_ABI + size_type __removed __attribute__((__unused__)) = 0; +#endif + _Base __to_destroy(get_allocator()); + _Base_iterator __first = _Base::begin(); + _Base_iterator __last = _Base::end(); + _Base_iterator __next = __first; + while (++__next != __last) + if (__binary_pred(*__first, *__next)) + { + this->_M_invalidate_if(_Equal(__next)); + __to_destroy.splice(__to_destroy.begin(), _M_base(), __next); + __next = __first; +#if !_GLIBCXX_USE_CXX11_ABI + _GLIBCXX20_ONLY( __removed++ ); +#endif + } + else + __first = __next; + +#if !_GLIBCXX_USE_CXX11_ABI + return _GLIBCXX20_ONLY( __removed ); +#else + return _GLIBCXX20_ONLY( __to_destroy.size() ); +#endif + } + +#undef _GLIBCXX_LIST_REMOVE_RETURN_TYPE_TAG +#undef _GLIBCXX20_ONLY + + void +#if __cplusplus >= 201103L + merge(list&& __x) +#else + merge(list& __x) +#endif + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 300. list::merge() specification incomplete + if (this != std::__addressof(__x)) + { + __glibcxx_check_sorted(_Base::begin(), _Base::end()); + __glibcxx_check_sorted(__x.begin().base(), __x.end().base()); + this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end())); + _Base::merge(_GLIBCXX_MOVE(__x._M_base())); + } + } + +#if __cplusplus >= 201103L + void + merge(list& __x) + { merge(std::move(__x)); } +#endif + + template + void +#if __cplusplus >= 201103L + merge(list&& __x, _Compare __comp) +#else + merge(list& __x, _Compare __comp) +#endif + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 300. list::merge() specification incomplete + if (this != std::__addressof(__x)) + { + __glibcxx_check_sorted_pred(_Base::begin(), _Base::end(), + __comp); + __glibcxx_check_sorted_pred(__x.begin().base(), __x.end().base(), + __comp); + this->_M_transfer_from_if(__x, _Not_equal(__x._M_base().end())); + _Base::merge(_GLIBCXX_MOVE(__x._M_base()), __comp); + } + } + +#if __cplusplus >= 201103L + template + void + merge(list& __x, _Compare __comp) + { merge(std::move(__x), __comp); } +#endif + + void + sort() { _Base::sort(); } + + template + void + sort(_StrictWeakOrdering __pred) { _Base::sort(__pred); } + + using _Base::reverse; + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + }; + +#if __cpp_deduction_guides >= 201606 + template::value_type, + typename _Allocator = allocator<_ValT>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireAllocator<_Allocator>> + list(_InputIterator, _InputIterator, _Allocator = _Allocator()) + -> list<_ValT, _Allocator>; +#endif + + template + inline bool + operator==(const list<_Tp, _Alloc>& __lhs, + const list<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + +#if __cpp_lib_three_way_comparison + template + constexpr __detail::__synth3way_t<_Tp> + operator<=>(const list<_Tp, _Alloc>& __x, const list<_Tp, _Alloc>& __y) + { return __x._M_base() <=> __y._M_base(); } +#else + template + inline bool + operator!=(const list<_Tp, _Alloc>& __lhs, + const list<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const list<_Tp, _Alloc>& __lhs, + const list<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const list<_Tp, _Alloc>& __lhs, + const list<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const list<_Tp, _Alloc>& __lhs, + const list<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const list<_Tp, _Alloc>& __lhs, + const list<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } +#endif // three-way comparison + + template + inline void + swap(list<_Tp, _Alloc>& __lhs, list<_Tp, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs))) + { __lhs.swap(__rhs); } + +} // namespace __debug +} // namespace std + +namespace __gnu_debug +{ +#ifndef _GLIBCXX_USE_CXX11_ABI + // If not using C++11 list::size() is not in O(1) so we do not use it. + template + struct _Sequence_traits > + { + typedef typename std::__debug::list<_Tp, _Alloc>::iterator _It; + + static typename _Distance_traits<_It>::__type + _S_size(const std::__debug::list<_Tp, _Alloc>& __seq) + { + return __seq.empty() + ? std::make_pair(0, __dp_exact) : std::make_pair(1, __dp_sign); + } + }; +#endif + +#ifndef _GLIBCXX_DEBUG_PEDANTIC + template + struct _Insert_range_from_self_is_safe > + { enum { __value = 1 }; }; +#endif +} + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/macros.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/macros.h new file mode 100644 index 0000000..9e1288c --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/macros.h @@ -0,0 +1,466 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/macros.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MACROS_H +#define _GLIBCXX_DEBUG_MACROS_H 1 + +/** + * Macros used by the implementation to verify certain + * properties. These macros may only be used directly by the debug + * wrappers. Note that these are macros (instead of the more obviously + * @a correct choice of making them functions) because we need line and + * file information at the call site, to minimize the distance between + * 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); \ + } while (false) + +#define _GLIBCXX_DEBUG_VERIFY_AT(_Cond,_ErrMsg,_File,_Line) \ + _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond,_ErrMsg,_File,_Line,__PRETTY_FUNCTION__) + +#define _GLIBCXX_DEBUG_VERIFY(_Cond,_ErrMsg) \ + _GLIBCXX_DEBUG_VERIFY_AT_F(_Cond, _ErrMsg, __FILE__, __LINE__, \ + __PRETTY_FUNCTION__) + +// Verify that [_First, _Last) forms a valid iterator range. +#define __glibcxx_check_valid_range(_First,_Last) \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last), \ + _M_message(__gnu_debug::__msg_valid_range) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +#define __glibcxx_check_valid_range_at(_First,_Last,_File,_Line,_Func) \ +_GLIBCXX_DEBUG_VERIFY_AT_F(__gnu_debug::__valid_range(_First, _Last), \ + _M_message(__gnu_debug::__msg_valid_range) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last), \ + _File,_Line,_Func) + +#define __glibcxx_check_valid_range2(_First,_Last,_Dist) \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__valid_range(_First, _Last, _Dist), \ + _M_message(__gnu_debug::__msg_valid_range) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +#define __glibcxx_check_valid_constructor_range(_First,_Last) \ + __gnu_debug::__check_valid_range(_First, _Last, \ + __FILE__, __LINE__, __PRETTY_FUNCTION__) + +// Verify that [_First, _Last) forms a non-empty iterator range. +#define __glibcxx_check_non_empty_range(_First,_Last) \ +_GLIBCXX_DEBUG_VERIFY(_First != _Last, \ + _M_message(__gnu_debug::__msg_non_empty_range) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +// Verify that [_First, _First + _Size) forms a valid range. +#define __glibcxx_check_can_increment(_First,_Size) \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__can_advance(_First, _Size), \ + _M_message(__gnu_debug::__msg_iter_subscript_oob) \ + ._M_iterator(_First, #_First) \ + ._M_integer(_Size, #_Size)) + +#define __glibcxx_check_can_increment_dist(_First,_Dist,_Way) \ + _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__can_advance(_First, _Dist, _Way), \ + _M_message(__gnu_debug::__msg_iter_subscript_oob) \ + ._M_iterator(_First, #_First) \ + ._M_integer(_Way * _Dist.first, #_Dist)) + +#define __glibcxx_check_can_increment_range(_First1,_Last1,_First2) \ + do \ + { \ + typename __gnu_debug::_Distance_traits<__decltype(_First1)>::__type __dist;\ + _GLIBCXX_DEBUG_VERIFY_AT_F( \ + __gnu_debug::__valid_range(_First1, _Last1, __dist),\ + _M_message(__gnu_debug::__msg_valid_range) \ + ._M_iterator(_First1, #_First1) \ + ._M_iterator(_Last1, #_Last1), \ + __FILE__,__LINE__,__PRETTY_FUNCTION__); \ + _GLIBCXX_DEBUG_VERIFY_AT_F( \ + __gnu_debug::__can_advance(_First2, __dist, 1), \ + _M_message(__gnu_debug::__msg_iter_subscript_oob)\ + ._M_iterator(_First2, #_First2) \ + ._M_integer(__dist.first), \ + __FILE__,__LINE__,__PRETTY_FUNCTION__); \ + } while(false) + +#define __glibcxx_check_can_decrement_range(_First1,_Last1,_First2) \ + do \ + { \ + typename __gnu_debug::_Distance_traits<__decltype(_First1)>::__type __dist;\ + _GLIBCXX_DEBUG_VERIFY_AT_F( \ + __gnu_debug::__valid_range(_First1, _Last1, __dist),\ + _M_message(__gnu_debug::__msg_valid_range) \ + ._M_iterator(_First1, #_First1) \ + ._M_iterator(_Last1, #_Last1), \ + __FILE__,__LINE__,__PRETTY_FUNCTION__); \ + _GLIBCXX_DEBUG_VERIFY_AT_F( \ + __gnu_debug::__can_advance(_First2, __dist, -1), \ + _M_message(__gnu_debug::__msg_iter_subscript_oob)\ + ._M_iterator(_First2, #_First2) \ + ._M_integer(-__dist.first), \ + __FILE__,__LINE__,__PRETTY_FUNCTION__); \ + } while(false) + +/** Verify that we can insert into *this with the iterator _Position. + * Insertion into a container at a specific position requires that + * the iterator be nonsingular, either dereferenceable or past-the-end, + * and that it reference the sequence we are inserting into. Note that + * this macro is only valid when the container is a_Safe_sequence and + * the iterator is a _Safe_iterator. +*/ +#define __glibcxx_check_insert(_Position) \ +_GLIBCXX_DEBUG_VERIFY(!_Position._M_singular(), \ + _M_message(__gnu_debug::__msg_insert_singular) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)); \ +_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ + _M_message(__gnu_debug::__msg_insert_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)) + +/** Verify that we can insert into *this after the iterator _Position. + * Insertion into a container after a specific position requires that + * the iterator be nonsingular, either dereferenceable or before-begin, + * and that it reference the sequence we are inserting into. Note that + * this macro is only valid when the container is a_Safe_sequence and + * the iterator is a _Safe_iterator. +*/ +#define __glibcxx_check_insert_after(_Position) \ +__glibcxx_check_insert(_Position); \ +_GLIBCXX_DEBUG_VERIFY(!_Position._M_is_end(), \ + _M_message(__gnu_debug::__msg_insert_after_end) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)) + +/** Verify that we can insert the values in the iterator range + * [_First, _Last) into *this with the iterator _Position. Insertion + * into a container at a specific position requires that the iterator + * be nonsingular (i.e., either dereferenceable or past-the-end), + * that it reference the sequence we are inserting into, and that the + * iterator range [_First, _Last) is a valid (possibly empty) + * range which does not reference the sequence we are inserting into. + * Note that this macro is only valid when the container is a + * _Safe_sequence and the _Position iterator is a _Safe_iterator. +*/ +#define __glibcxx_check_insert_range(_Position,_First,_Last,_Dist) \ +__glibcxx_check_valid_range2(_First,_Last,_Dist); \ +__glibcxx_check_insert(_Position); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First,_Last),\ + _M_message(__gnu_debug::__msg_insert_range_from_self)\ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_sequence(*this, "this")) + +/** Verify that we can insert the values in the iterator range + * [_First, _Last) into *this after the iterator _Position. Insertion + * into a container after a specific position requires that the iterator + * be nonsingular (i.e., either dereferenceable or past-the-end), + * that it reference the sequence we are inserting into, and that the + * iterator range [_First, _Last) is a valid (possibly empty) + * range which does not reference the sequence we are inserting into. + * Note that this macro is only valid when the container is a + * _Safe_sequence and the _Position iterator is a _Safe_iterator. +*/ +#define __glibcxx_check_insert_range_after(_Position,_First,_Last,_Dist)\ +__glibcxx_check_valid_range2(_First,_Last,_Dist); \ +__glibcxx_check_insert_after(_Position); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__foreign_iterator(_Position,_First,_Last),\ + _M_message(__gnu_debug::__msg_insert_range_from_self)\ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_sequence(*this, "this")) + +/** Verify that we can erase the element referenced by the iterator + * _Position. We can erase the element if the _Position iterator is + * dereferenceable and references this sequence. +*/ +#define __glibcxx_check_erase(_Position) \ +_GLIBCXX_DEBUG_VERIFY(_Position._M_dereferenceable(), \ + _M_message(__gnu_debug::__msg_erase_bad) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)); \ +_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)) + +/** Verify that we can erase the element after the iterator + * _Position. We can erase the element if the _Position iterator is + * before a dereferenceable one and references this sequence. +*/ +#define __glibcxx_check_erase_after(_Position) \ +_GLIBCXX_DEBUG_VERIFY(_Position._M_before_dereferenceable(), \ + _M_message(__gnu_debug::__msg_erase_after_bad) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)); \ +_GLIBCXX_DEBUG_VERIFY(_Position._M_attached_to(this), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_Position, #_Position)) + +/** Verify that we can erase the elements in the iterator range + * [_First, _Last). We can erase the elements if [_First, _Last) is a + * valid iterator range within this sequence. +*/ +#define __glibcxx_check_erase_range(_First,_Last) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +/** Verify that we can erase the elements in the iterator range + * (_First, _Last). We can erase the elements if (_First, _Last) is a + * valid iterator range within this sequence. +*/ +#define __glibcxx_check_erase_range_after(_First,_Last) \ +_GLIBCXX_DEBUG_VERIFY(!_First._M_singular() && !_Last._M_singular(), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)); \ +_GLIBCXX_DEBUG_VERIFY(_First._M_can_compare(_Last), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)); \ +_GLIBCXX_DEBUG_VERIFY(_First._M_attached_to(this), \ + _M_message(__gnu_debug::__msg_erase_different) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First)); \ +_GLIBCXX_DEBUG_VERIFY(_First != _Last, \ + _M_message(__gnu_debug::__msg_valid_range2) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)); \ +_GLIBCXX_DEBUG_VERIFY(_First._M_incrementable(), \ + _M_message(__gnu_debug::__msg_valid_range2) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)); \ +_GLIBCXX_DEBUG_VERIFY(!_Last._M_is_before_begin(), \ + _M_message(__gnu_debug::__msg_valid_range2) \ + ._M_sequence(*this, "this") \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) \ + +// Verify that the subscript _N is less than the container's size. +#define __glibcxx_check_subscript(_N) \ +_GLIBCXX_DEBUG_VERIFY(_N < this->size(), \ + _M_message(__gnu_debug::__msg_subscript_oob) \ + ._M_sequence(*this, "this") \ + ._M_integer(_N, #_N) \ + ._M_integer(this->size(), "size")) + +// Verify that the bucket _N is less than the container's buckets count. +#define __glibcxx_check_bucket_index(_N) \ +_GLIBCXX_DEBUG_VERIFY(_N < this->bucket_count(), \ + _M_message(__gnu_debug::__msg_bucket_index_oob) \ + ._M_sequence(*this, "this") \ + ._M_integer(_N, #_N) \ + ._M_integer(this->bucket_count(), "size")) + +// Verify that the container is nonempty +#define __glibcxx_check_nonempty() \ +_GLIBCXX_DEBUG_VERIFY(! this->empty(), \ + _M_message(__gnu_debug::__msg_empty) \ + ._M_sequence(*this, "this")) + +// Verify that a predicate is irreflexive +#define __glibcxx_check_irreflexive(_First,_Last) \ + _GLIBCXX_DEBUG_VERIFY(_First == _Last || !(*_First < *_First), \ + _M_message(__gnu_debug::__msg_irreflexive_ordering) \ + ._M_iterator_value_type(_First, "< operator type")) + +#if __cplusplus >= 201103L +# define __glibcxx_check_irreflexive2(_First,_Last) \ + _GLIBCXX_DEBUG_VERIFY(_First == _Last \ + || __gnu_debug::__is_irreflexive(_First), \ + _M_message(__gnu_debug::__msg_irreflexive_ordering) \ + ._M_iterator_value_type(_First, "< operator type")) +#else +# define __glibcxx_check_irreflexive2(_First,_Last) +#endif + +#define __glibcxx_check_irreflexive_pred(_First,_Last,_Pred) \ + _GLIBCXX_DEBUG_VERIFY(_First == _Last || !_Pred(*_First, *_First), \ + _M_message(__gnu_debug::__msg_irreflexive_ordering) \ + ._M_instance(_Pred, "functor") \ + ._M_iterator_value_type(_First, "ordered type")) + +#if __cplusplus >= 201103L +# define __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred) \ + _GLIBCXX_DEBUG_VERIFY(_First == _Last \ + ||__gnu_debug::__is_irreflexive_pred(_First, _Pred), \ + _M_message(__gnu_debug::__msg_irreflexive_ordering) \ + ._M_instance(_Pred, "functor") \ + ._M_iterator_value_type(_First, "ordered type")) +#else +# define __glibcxx_check_irreflexive_pred2(_First,_Last,_Pred) +#endif + +// Verify that the iterator range [_First, _Last) is sorted +#define __glibcxx_check_sorted(_First,_Last) \ +__glibcxx_check_valid_range(_First,_Last); \ +__glibcxx_check_irreflexive(_First,_Last); \ + _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last)), \ + _M_message(__gnu_debug::__msg_unsorted) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +/** Verify that the iterator range [_First, _Last) is sorted by the + predicate _Pred. */ +#define __glibcxx_check_sorted_pred(_First,_Last,_Pred) \ +__glibcxx_check_valid_range(_First,_Last); \ +__glibcxx_check_irreflexive_pred(_First,_Last,_Pred); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_sorted( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Pred), \ + _M_message(__gnu_debug::__msg_unsorted_pred) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Pred)) + +// Special variant for std::merge, std::includes, std::set_* +#define __glibcxx_check_sorted_set(_First1,_Last1,_First2) \ +__glibcxx_check_valid_range(_First1,_Last1); \ +_GLIBCXX_DEBUG_VERIFY( \ + __gnu_debug::__check_sorted_set(__gnu_debug::__base(_First1), \ + __gnu_debug::__base(_Last1), _First2),\ + _M_message(__gnu_debug::__msg_unsorted) \ + ._M_iterator(_First1, #_First1) \ + ._M_iterator(_Last1, #_Last1)) + +// Likewise with a _Pred. +#define __glibcxx_check_sorted_set_pred(_First1,_Last1,_First2,_Pred) \ +__glibcxx_check_valid_range(_First1,_Last1); \ +_GLIBCXX_DEBUG_VERIFY( \ + __gnu_debug::__check_sorted_set(__gnu_debug::__base(_First1), \ + __gnu_debug::__base(_Last1), \ + _First2, _Pred), \ + _M_message(__gnu_debug::__msg_unsorted_pred) \ + ._M_iterator(_First1, #_First1) \ + ._M_iterator(_Last1, #_Last1) \ + ._M_string(#_Pred)) + +/** Verify that the iterator range [_First, _Last) is partitioned + w.r.t. the value _Value. */ +#define __glibcxx_check_partitioned_lower(_First,_Last,_Value) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value), \ + _M_message(__gnu_debug::__msg_unpartitioned) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Value)) + +#define __glibcxx_check_partitioned_upper(_First,_Last,_Value) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value), \ + _M_message(__gnu_debug::__msg_unpartitioned) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Value)) + +/** Verify that the iterator range [_First, _Last) is partitioned + w.r.t. the value _Value and predicate _Pred. */ +#define __glibcxx_check_partitioned_lower_pred(_First,_Last,_Value,_Pred) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_lower( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value, _Pred), \ + _M_message(__gnu_debug::__msg_unpartitioned_pred) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Pred) \ + ._M_string(#_Value)) + +/** Verify that the iterator range [_First, _Last) is partitioned + w.r.t. the value _Value and predicate _Pred. */ +#define __glibcxx_check_partitioned_upper_pred(_First,_Last,_Value,_Pred) \ +__glibcxx_check_valid_range(_First,_Last); \ +_GLIBCXX_DEBUG_VERIFY(__gnu_debug::__check_partitioned_upper( \ + __gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), _Value, _Pred), \ + _M_message(__gnu_debug::__msg_unpartitioned_pred) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Pred) \ + ._M_string(#_Value)) + +// Verify that the iterator range [_First, _Last) is a heap +#define __glibcxx_check_heap(_First,_Last) \ + _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last)), \ + _M_message(__gnu_debug::__msg_not_heap) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last)) + +/** Verify that the iterator range [_First, _Last) is a heap + w.r.t. the predicate _Pred. */ +#define __glibcxx_check_heap_pred(_First,_Last,_Pred) \ + _GLIBCXX_DEBUG_VERIFY(std::__is_heap(__gnu_debug::__base(_First), \ + __gnu_debug::__base(_Last), \ + _Pred), \ + _M_message(__gnu_debug::__msg_not_heap_pred) \ + ._M_iterator(_First, #_First) \ + ._M_iterator(_Last, #_Last) \ + ._M_string(#_Pred)) + +// Verify that load factor is positive +#define __glibcxx_check_max_load_factor(_F) \ +_GLIBCXX_DEBUG_VERIFY(_F > 0.0f, \ + _M_message(__gnu_debug::__msg_valid_load_factor) \ + ._M_sequence(*this, "this")) + +#define __glibcxx_check_equal_allocs(_This, _Other) \ +_GLIBCXX_DEBUG_VERIFY(_This.get_allocator() == _Other.get_allocator(), \ + _M_message(__gnu_debug::__msg_equal_allocs) \ + ._M_sequence(_This, "this")) + +#define __glibcxx_check_string(_String) _GLIBCXX_DEBUG_PEDASSERT(_String != 0) +#define __glibcxx_check_string_len(_String,_Len) \ + _GLIBCXX_DEBUG_PEDASSERT(_String != 0 || _Len == 0) + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/map b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/map new file mode 100644 index 0000000..c539638 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/map @@ -0,0 +1,46 @@ +// Debugging map/multimap implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/map + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MAP +#define _GLIBCXX_DEBUG_MAP 1 + +#pragma GCC system_header + +#include +namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { + template + class map; + template + class multimap; +} } // namespace std::__debug + +#include +#include +#include + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/map.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/map.h new file mode 100644 index 0000000..ab34b2a --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/map.h @@ -0,0 +1,807 @@ +// Debugging map implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/map.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MAP_H +#define _GLIBCXX_DEBUG_MAP_H 1 + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::map with safety/checking/debug instrumentation. + template, + typename _Allocator = std::allocator > > + class map + : public __gnu_debug::_Safe_container< + map<_Key, _Tp, _Compare, _Allocator>, _Allocator, + __gnu_debug::_Safe_node_sequence>, + public _GLIBCXX_STD_C::map<_Key, _Tp, _Compare, _Allocator> + { + typedef _GLIBCXX_STD_C::map< + _Key, _Tp, _Compare, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + map, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; + + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + + template + friend class ::__gnu_debug::_Safe_iterator; + + // Reference wrapper for base class. Disambiguates map(const _Base&) + // from copy constructor by requiring a user-defined conversion. + // See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + // types: + typedef _Key key_type; + typedef _Tp mapped_type; + typedef std::pair value_type; + typedef _Compare key_compare; + typedef _Allocator allocator_type; + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator<_Base_iterator, map> + iterator; + typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, map> + const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.3.1.1 construct/copy/destroy: + +#if __cplusplus < 201103L + map() : _Base() { } + + map(const map& __x) + : _Base(__x) { } + + ~map() { } +#else + map() = default; + map(const map&) = default; + map(map&&) = default; + + map(initializer_list __l, + const _Compare& __c = _Compare(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __c, __a) { } + + explicit + map(const allocator_type& __a) + : _Base(__a) { } + + map(const map& __m, const allocator_type& __a) + : _Base(__m, __a) { } + + map(map&& __m, const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) ) + : _Safe(std::move(__m._M_safe()), __a), + _Base(std::move(__m._M_base()), __a) { } + + map(initializer_list __l, const allocator_type& __a) + : _Base(__l, __a) { } + + template + map(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __a) + { } + + ~map() = default; +#endif + + map(_Base_ref __x) + : _Base(__x._M_ref) { } + + explicit map(const _Compare& __comp, + const _Allocator& __a = _Allocator()) + : _Base(__comp, __a) { } + + template + map(_InputIterator __first, _InputIterator __last, + const _Compare& __comp = _Compare(), + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), + __comp, __a) { } + +#if __cplusplus < 201103L + map& + operator=(const map& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + return *this; + } +#else + map& + operator=(const map&) = default; + + map& + operator=(map&&) = default; + + map& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } +#endif + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 133. map missing get_allocator() + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // capacity: + using _Base::empty; + using _Base::size; + using _Base::max_size; + + // 23.3.1.2 element access: + using _Base::operator[]; + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 464. Suggestion for new member functions in standard containers. + using _Base::at; + + // modifiers: +#if __cplusplus >= 201103L + template + std::pair + emplace(_Args&&... __args) + { + auto __res = _Base::emplace(std::forward<_Args>(__args)...); + return { { __res.first, this }, __res.second }; + } + + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return + { + _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...), + this + }; + } +#endif + + std::pair + insert(const value_type& __x) + { + std::pair<_Base_iterator, bool> __res = _Base::insert(__x); + return std::pair(iterator(__res.first, this), + __res.second); + } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + std::pair + insert(value_type&& __x) + { + auto __res = _Base::insert(std::move(__x)); + return { { __res.first, this }, __res.second }; + } + + template::value>::type> + std::pair + insert(_Pair&& __x) + { + auto __res = _Base::insert(std::forward<_Pair>(__x)); + return { { __res.first, this }, __res.second }; + } +#endif + +#if __cplusplus >= 201103L + void + insert(std::initializer_list __list) + { _Base::insert(__list); } +#endif + + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const value_type& __x) +#else + insert(iterator __position, const value_type& __x) +#endif + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), __x), this); + } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __position, value_type&& __x) + { + __glibcxx_check_insert(__position); + return { _Base::insert(__position.base(), std::move(__x)), this }; + } + + template::value>::type> + iterator + insert(const_iterator __position, _Pair&& __x) + { + __glibcxx_check_insert(__position); + return + { + _Base::insert(__position.base(), std::forward<_Pair>(__x)), + this + }; + } +#endif + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + } + + +#if __cplusplus > 201402L + template + pair + try_emplace(const key_type& __k, _Args&&... __args) + { + auto __res = _Base::try_emplace(__k, + std::forward<_Args>(__args)...); + return { { __res.first, this }, __res.second }; + } + + template + pair + try_emplace(key_type&& __k, _Args&&... __args) + { + auto __res = _Base::try_emplace(std::move(__k), + std::forward<_Args>(__args)...); + return { { __res.first, this }, __res.second }; + } + + template + iterator + try_emplace(const_iterator __hint, const key_type& __k, + _Args&&... __args) + { + __glibcxx_check_insert(__hint); + return + { + _Base::try_emplace(__hint.base(), __k, + std::forward<_Args>(__args)...), + this + }; + } + + template + iterator + try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args) + { + __glibcxx_check_insert(__hint); + return + { + _Base::try_emplace(__hint.base(), std::move(__k), + std::forward<_Args>(__args)...), + this + }; + } + + template + std::pair + insert_or_assign(const key_type& __k, _Obj&& __obj) + { + auto __res = _Base::insert_or_assign(__k, + std::forward<_Obj>(__obj)); + return { { __res.first, this }, __res.second }; + } + + template + std::pair + insert_or_assign(key_type&& __k, _Obj&& __obj) + { + auto __res = _Base::insert_or_assign(std::move(__k), + std::forward<_Obj>(__obj)); + return { { __res.first, this }, __res.second }; + } + + template + iterator + insert_or_assign(const_iterator __hint, + const key_type& __k, _Obj&& __obj) + { + __glibcxx_check_insert(__hint); + return + { + _Base::insert_or_assign(__hint.base(), __k, + std::forward<_Obj>(__obj)), + this + }; + } + + template + iterator + insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj) + { + __glibcxx_check_insert(__hint); + return + { + _Base::insert_or_assign(__hint.base(), std::move(__k), + std::forward<_Obj>(__obj)), + this + }; + } +#endif // C++17 + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + using insert_return_type = _Node_insert_return; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return _Base::extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = find(__key); + if (__position != end()) + return extract(__position); + return {}; + } + + insert_return_type + insert(node_type&& __nh) + { + auto __ret = _Base::insert(std::move(__nh)); + return + { { __ret.position, this }, __ret.inserted, std::move(__ret.node) }; + } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return { _Base::insert(__hint.base(), std::move(__nh)), this }; + } + + using _Base::merge; +#endif // C++17 + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return { _Base::erase(__position.base()), this }; + } + + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(iterator __position) + { return erase(const_iterator(__position)); } +#else + void + erase(iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + _Base::erase(__position.base()); + } +#endif + + size_type + erase(const key_type& __x) + { + _Base_iterator __victim = _Base::find(__x); + if (__victim == _Base::end()) + return 0; + else + { + this->_M_invalidate_if(_Equal(__victim)); + _Base::erase(__victim); + return 1; + } + } + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __first, const_iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_const_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + + return { _Base::erase(__first.base(), __last.base()), this }; + } +#else + void + erase(iterator __first, iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + _Base::erase(__first.base(), __last.base()); + } +#endif + + void + swap(map& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + this->_M_invalidate_all(); + _Base::clear(); + } + + // observers: + using _Base::key_comp; + using _Base::value_comp; + + // 23.3.1.3 map operations: + iterator + find(const key_type& __x) + { return iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + find(const _Kt& __x) + { return { _Base::find(__x), this }; } +#endif + + const_iterator + find(const key_type& __x) const + { return const_iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + find(const _Kt& __x) const + { return { _Base::find(__x), this }; } +#endif + + using _Base::count; + + iterator + lower_bound(const key_type& __x) + { return iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + lower_bound(const _Kt& __x) + { return { _Base::lower_bound(__x), this }; } +#endif + + const_iterator + lower_bound(const key_type& __x) const + { return const_iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + lower_bound(const _Kt& __x) const + { return { _Base::lower_bound(__x), this }; } +#endif + + iterator + upper_bound(const key_type& __x) + { return iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + upper_bound(const _Kt& __x) + { return { _Base::upper_bound(__x), this }; } +#endif + + const_iterator + upper_bound(const key_type& __x) const + { return const_iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + upper_bound(const _Kt& __x) const + { return { _Base::upper_bound(__x), this }; } +#endif + + std::pair + equal_range(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(iterator(__res.first, this), + iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + std::pair + equal_range(const key_type& __x) const + { + std::pair<_Base_const_iterator, _Base_const_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(const_iterator(__res.first, this), + const_iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) const + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + }; + +#if __cpp_deduction_guides >= 201606 + + template>, + typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireNotAllocator<_Compare>, + typename = _RequireAllocator<_Allocator>> + map(_InputIterator, _InputIterator, + _Compare = _Compare(), _Allocator = _Allocator()) + -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, + _Compare, _Allocator>; + + template, + typename _Allocator = allocator>, + typename = _RequireNotAllocator<_Compare>, + typename = _RequireAllocator<_Allocator>> + map(initializer_list>, + _Compare = _Compare(), _Allocator = _Allocator()) + -> map<_Key, _Tp, _Compare, _Allocator>; + + template , + typename = _RequireAllocator<_Allocator>> + map(_InputIterator, _InputIterator, _Allocator) + -> map<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, + less<__iter_key_t<_InputIterator>>, _Allocator>; + + template> + map(initializer_list>, _Allocator) + -> map<_Key, _Tp, less<_Key>, _Allocator>; + +#endif // deduction guides + + template + inline bool + operator==(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + +#if __cpp_lib_three_way_comparison + template + inline __detail::__synth3way_t> + operator<=>(const map<_Key, _Tp, _Compare, _Alloc>& __lhs, + const map<_Key, _Tp, _Compare, _Alloc>& __rhs) + { return __lhs._M_base() <=> __rhs._M_base(); } +#else + template + inline bool + operator!=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const map<_Key, _Tp, _Compare, _Allocator>& __lhs, + const map<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } +#endif // three-way comparison + + template + inline void + swap(map<_Key, _Tp, _Compare, _Allocator>& __lhs, + map<_Key, _Tp, _Compare, _Allocator>& __rhs) + _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs))) + { __lhs.swap(__rhs); } + +} // namespace __debug +} // namespace std + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/multimap.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/multimap.h new file mode 100644 index 0000000..96a44f4 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/multimap.h @@ -0,0 +1,688 @@ +// Debugging multimap implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/multimap.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MULTIMAP_H +#define _GLIBCXX_DEBUG_MULTIMAP_H 1 + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::multimap with safety/checking/debug instrumentation. + template, + typename _Allocator = std::allocator > > + class multimap + : public __gnu_debug::_Safe_container< + multimap<_Key, _Tp, _Compare, _Allocator>, _Allocator, + __gnu_debug::_Safe_node_sequence>, + public _GLIBCXX_STD_C::multimap<_Key, _Tp, _Compare, _Allocator> + { + typedef _GLIBCXX_STD_C::multimap< + _Key, _Tp, _Compare, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + multimap, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; + + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + + template + friend class ::__gnu_debug::_Safe_iterator; + + // Reference wrapper for base class. Disambiguates multimap(const _Base&) + // from copy constructor by requiring a user-defined conversion. + // See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + // types: + typedef _Key key_type; + typedef _Tp mapped_type; + typedef std::pair value_type; + typedef _Compare key_compare; + typedef _Allocator allocator_type; + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator<_Base_iterator, multimap> + iterator; + typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, + multimap> const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.3.1.1 construct/copy/destroy: + +#if __cplusplus < 201103L + multimap() : _Base() { } + + multimap(const multimap& __x) + : _Base(__x) { } + + ~multimap() { } +#else + multimap() = default; + multimap(const multimap&) = default; + multimap(multimap&&) = default; + + multimap(initializer_list __l, + const _Compare& __c = _Compare(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __c, __a) { } + + explicit + multimap(const allocator_type& __a) + : _Base(__a) { } + + multimap(const multimap& __m, const allocator_type& __a) + : _Base(__m, __a) { } + + multimap(multimap&& __m, const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) ) + : _Safe(std::move(__m._M_safe()), __a), + _Base(std::move(__m._M_base()), __a) { } + + multimap(initializer_list __l, const allocator_type& __a) + : _Base(__l, __a) { } + + template + multimap(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __a) { } + + ~multimap() = default; +#endif + + explicit multimap(const _Compare& __comp, + const _Allocator& __a = _Allocator()) + : _Base(__comp, __a) { } + + template + multimap(_InputIterator __first, _InputIterator __last, + const _Compare& __comp = _Compare(), + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), + __comp, __a) { } + + multimap(_Base_ref __x) + : _Base(__x._M_ref) { } + +#if __cplusplus < 201103L + multimap& + operator=(const multimap& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + return *this; + } +#else + multimap& + operator=(const multimap&) = default; + + multimap& + operator=(multimap&&) = default; + + multimap& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } +#endif + + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // capacity: + using _Base::empty; + using _Base::size; + using _Base::max_size; + + // modifiers: +#if __cplusplus >= 201103L + template + iterator + emplace(_Args&&... __args) + { return { _Base::emplace(std::forward<_Args>(__args)...), this }; } + + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return + { + _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...), + this + }; + } +#endif + + iterator + insert(const value_type& __x) + { return iterator(_Base::insert(__x), this); } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(value_type&& __x) + { return { _Base::insert(std::move(__x)), this }; } + + template::value>::type> + iterator + insert(_Pair&& __x) + { return { _Base::insert(std::forward<_Pair>(__x)), this }; } +#endif + +#if __cplusplus >= 201103L + void + insert(std::initializer_list __list) + { _Base::insert(__list); } +#endif + + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const value_type& __x) +#else + insert(iterator __position, const value_type& __x) +#endif + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), __x), this); + } + +#if __cplusplus >= 201103L + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __position, value_type&& __x) + { + __glibcxx_check_insert(__position); + return { _Base::insert(__position.base(), std::move(__x)), this }; + } + + template::value>::type> + iterator + insert(const_iterator __position, _Pair&& __x) + { + __glibcxx_check_insert(__position); + return + { + _Base::insert(__position.base(), std::forward<_Pair>(__x)), + this + }; + } +#endif + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + } + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return _Base::extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = find(__key); + if (__position != end()) + return extract(__position); + return {}; + } + + iterator + insert(node_type&& __nh) + { return { _Base::insert(std::move(__nh)), this }; } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return { _Base::insert(__hint.base(), std::move(__nh)), this }; + } + + using _Base::merge; +#endif // C++17 + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return { _Base::erase(__position.base()), this }; + } + + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(iterator __position) + { return erase(const_iterator(__position)); } +#else + void + erase(iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + _Base::erase(__position.base()); + } +#endif + + size_type + erase(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __victims = + _Base::equal_range(__x); + size_type __count = 0; + _Base_iterator __victim = __victims.first; + while (__victim != __victims.second) + { + this->_M_invalidate_if(_Equal(__victim)); + _Base::erase(__victim++); + ++__count; + } + return __count; + } + +#if __cplusplus >= 201103L + iterator + erase(const_iterator __first, const_iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_const_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + + return { _Base::erase(__first.base(), __last.base()), this }; + } +#else + void + erase(iterator __first, iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + _Base::erase(__first.base(), __last.base()); + } +#endif + + void + swap(multimap& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + this->_M_invalidate_all(); + _Base::clear(); + } + + // observers: + using _Base::key_comp; + using _Base::value_comp; + + // 23.3.1.3 multimap operations: + iterator + find(const key_type& __x) + { return iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + find(const _Kt& __x) + { return { _Base::find(__x), this }; } +#endif + + const_iterator + find(const key_type& __x) const + { return const_iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + find(const _Kt& __x) const + { return { _Base::find(__x), this }; } +#endif + + using _Base::count; + + iterator + lower_bound(const key_type& __x) + { return iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + lower_bound(const _Kt& __x) + { return { _Base::lower_bound(__x), this }; } +#endif + + const_iterator + lower_bound(const key_type& __x) const + { return const_iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + lower_bound(const _Kt& __x) const + { return { _Base::lower_bound(__x), this }; } +#endif + + iterator + upper_bound(const key_type& __x) + { return iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + upper_bound(const _Kt& __x) + { return { _Base::upper_bound(__x), this }; } +#endif + + const_iterator + upper_bound(const key_type& __x) const + { return const_iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + const_iterator + upper_bound(const _Kt& __x) const + { return { _Base::upper_bound(__x), this }; } +#endif + + std::pair + equal_range(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(iterator(__res.first, this), + iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + std::pair + equal_range(const key_type& __x) const + { + std::pair<_Base_const_iterator, _Base_const_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(const_iterator(__res.first, this), + const_iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) const + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + }; + +#if __cpp_deduction_guides >= 201606 + + template>, + typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireNotAllocator<_Compare>, + typename = _RequireAllocator<_Allocator>> + multimap(_InputIterator, _InputIterator, + _Compare = _Compare(), _Allocator = _Allocator()) + -> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, + _Compare, _Allocator>; + + template, + typename _Allocator = allocator>, + typename = _RequireNotAllocator<_Compare>, + typename = _RequireAllocator<_Allocator>> + multimap(initializer_list>, + _Compare = _Compare(), _Allocator = _Allocator()) + -> multimap<_Key, _Tp, _Compare, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + multimap(_InputIterator, _InputIterator, _Allocator) + -> multimap<__iter_key_t<_InputIterator>, __iter_val_t<_InputIterator>, + less<__iter_key_t<_InputIterator>>, _Allocator>; + + template> + multimap(initializer_list>, _Allocator) + -> multimap<_Key, _Tp, less<_Key>, _Allocator>; + +#endif + + template + inline bool + operator==(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + +#if __cpp_lib_three_way_comparison + template + inline __detail::__synth3way_t> + operator<=>(const multimap<_Key, _Tp, _Compare, _Alloc>& __lhs, + const multimap<_Key, _Tp, _Compare, _Alloc>& __rhs) + { return __lhs._M_base() <=> __rhs._M_base(); } +#else + template + inline bool + operator!=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + const multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } +#endif // three-way comparison + + template + inline void + swap(multimap<_Key, _Tp, _Compare, _Allocator>& __lhs, + multimap<_Key, _Tp, _Compare, _Allocator>& __rhs) + _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs))) + { __lhs.swap(__rhs); } + +} // namespace __debug +} // namespace std + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/multiset.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/multiset.h new file mode 100644 index 0000000..0e76c5f --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/multiset.h @@ -0,0 +1,653 @@ +// Debugging multiset implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/multiset.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_MULTISET_H +#define _GLIBCXX_DEBUG_MULTISET_H 1 + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::multiset with safety/checking/debug instrumentation. + template, + typename _Allocator = std::allocator<_Key> > + class multiset + : public __gnu_debug::_Safe_container< + multiset<_Key, _Compare, _Allocator>, _Allocator, + __gnu_debug::_Safe_node_sequence>, + public _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> + { + typedef _GLIBCXX_STD_C::multiset<_Key, _Compare, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + multiset, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; + + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + + template + friend class ::__gnu_debug::_Safe_iterator; + + // Reference wrapper for base class. Disambiguates multiset(const _Base&) + // from copy constructor by requiring a user-defined conversion. + // See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + // types: + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; + typedef _Allocator allocator_type; + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator<_Base_iterator, multiset> + iterator; + typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, + multiset> const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.3.3.1 construct/copy/destroy: + +#if __cplusplus < 201103L + multiset() : _Base() { } + + multiset(const multiset& __x) + : _Base(__x) { } + + ~multiset() { } +#else + multiset() = default; + multiset(const multiset&) = default; + multiset(multiset&&) = default; + + multiset(initializer_list __l, + const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __comp, __a) { } + + explicit + multiset(const allocator_type& __a) + : _Base(__a) { } + + multiset(const multiset& __m, const allocator_type& __a) + : _Base(__m, __a) { } + + multiset(multiset&& __m, const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__m._M_base()), __a)) ) + : _Safe(std::move(__m._M_safe()), __a), + _Base(std::move(__m._M_base()), __a) { } + + multiset(initializer_list __l, const allocator_type& __a) + : _Base(__l, __a) + { } + + template + multiset(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __a) { } + + ~multiset() = default; +#endif + + explicit multiset(const _Compare& __comp, + const _Allocator& __a = _Allocator()) + : _Base(__comp, __a) { } + + template + multiset(_InputIterator __first, _InputIterator __last, + const _Compare& __comp = _Compare(), + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), + __comp, __a) { } + + multiset(_Base_ref __x) + : _Base(__x._M_ref) { } + +#if __cplusplus < 201103L + multiset& + operator=(const multiset& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + return *this; + } +#else + multiset& + operator=(const multiset&) = default; + + multiset& + operator=(multiset&&) = default; + + multiset& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } +#endif + + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // capacity: + using _Base::empty; + using _Base::size; + using _Base::max_size; + + // modifiers: +#if __cplusplus >= 201103L + template + iterator + emplace(_Args&&... __args) + { return { _Base::emplace(std::forward<_Args>(__args)...), this }; } + + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return + { + _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...), + this + }; + } +#endif + + iterator + insert(const value_type& __x) + { return iterator(_Base::insert(__x), this); } + +#if __cplusplus >= 201103L + iterator + insert(value_type&& __x) + { return { _Base::insert(std::move(__x)), this }; } +#endif + + iterator + insert(const_iterator __position, const value_type& __x) + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), __x), this); + } + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, value_type&& __x) + { + __glibcxx_check_insert(__position); + return { _Base::insert(__position.base(), std::move(__x)), this }; + } +#endif + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + } + +#if __cplusplus >= 201103L + void + insert(initializer_list __l) + { _Base::insert(__l); } +#endif + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return _Base::extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = find(__key); + if (__position != end()) + return extract(__position); + return {}; + } + + iterator + insert(node_type&& __nh) + { return { _Base::insert(std::move(__nh)), this }; } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return { _Base::insert(__hint.base(), std::move(__nh)), this }; + } + + using _Base::merge; +#endif // C++17 + +#if __cplusplus >= 201103L + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return { _Base::erase(__position.base()), this }; + } +#else + void + erase(iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + _Base::erase(__position.base()); + } +#endif + + size_type + erase(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __victims = + _Base::equal_range(__x); + size_type __count = 0; + _Base_iterator __victim = __victims.first; + while (__victim != __victims.second) + { + this->_M_invalidate_if(_Equal(__victim)); + _Base::erase(__victim++); + ++__count; + } + return __count; + } + +#if __cplusplus >= 201103L + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(const_iterator __first, const_iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_const_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + + return { _Base::erase(__first.base(), __last.base()), this }; + } +#else + void + erase(iterator __first, iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + _Base::erase(__first.base(), __last.base()); + } +#endif + + void + swap(multiset& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + this->_M_invalidate_all(); + _Base::clear(); + } + + // observers: + using _Base::key_comp; + using _Base::value_comp; + + // multiset operations: + iterator + find(const key_type& __x) + { return iterator(_Base::find(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + find(const key_type& __x) const + { return const_iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + find(const _Kt& __x) + { return { _Base::find(__x), this }; } + + template::type> + const_iterator + find(const _Kt& __x) const + { return { _Base::find(__x), this }; } +#endif + + using _Base::count; + + iterator + lower_bound(const key_type& __x) + { return iterator(_Base::lower_bound(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + lower_bound(const key_type& __x) const + { return const_iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + lower_bound(const _Kt& __x) + { return { _Base::lower_bound(__x), this }; } + + template::type> + const_iterator + lower_bound(const _Kt& __x) const + { return { _Base::lower_bound(__x), this }; } +#endif + + iterator + upper_bound(const key_type& __x) + { return iterator(_Base::upper_bound(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + upper_bound(const key_type& __x) const + { return const_iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + upper_bound(const _Kt& __x) + { return { _Base::upper_bound(__x), this }; } + + template::type> + const_iterator + upper_bound(const _Kt& __x) const + { return { _Base::upper_bound(__x), this }; } +#endif + + std::pair + equal_range(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(iterator(__res.first, this), + iterator(__res.second, this)); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + std::pair + equal_range(const key_type& __x) const + { + std::pair<_Base_const_iterator, _Base_const_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(const_iterator(__res.first, this), + const_iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } + + template::type> + std::pair + equal_range(const _Kt& __x) const + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + }; + +#if __cpp_deduction_guides >= 201606 + + template::value_type>, + typename _Allocator = + allocator::value_type>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireNotAllocator<_Compare>, + typename = _RequireAllocator<_Allocator>> + multiset(_InputIterator, _InputIterator, + _Compare = _Compare(), _Allocator = _Allocator()) + -> multiset::value_type, + _Compare, _Allocator>; + + template, + typename _Allocator = allocator<_Key>, + typename = _RequireNotAllocator<_Compare>, + typename = _RequireAllocator<_Allocator>> + multiset(initializer_list<_Key>, + _Compare = _Compare(), _Allocator = _Allocator()) + -> multiset<_Key, _Compare, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + multiset(_InputIterator, _InputIterator, _Allocator) + -> multiset::value_type, + less::value_type>, + _Allocator>; + + template> + multiset(initializer_list<_Key>, _Allocator) + -> multiset<_Key, less<_Key>, _Allocator>; + +#endif // deduction guides + + template + inline bool + operator==(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + +#if __cpp_lib_three_way_comparison + template + inline __detail::__synth3way_t<_Key> + operator<=>(const multiset<_Key, _Compare, _Alloc>& __lhs, + const multiset<_Key, _Compare, _Alloc>& __rhs) + { return __lhs._M_base() <=> __rhs._M_base(); } +#else + template + inline bool + operator!=(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const multiset<_Key, _Compare, _Allocator>& __lhs, + const multiset<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } +#endif // three-way comparison + + template + void + swap(multiset<_Key, _Compare, _Allocator>& __x, + multiset<_Key, _Compare, _Allocator>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { return __x.swap(__y); } + +} // namespace __debug +} // namespace std + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_base.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_base.h new file mode 100644 index 0000000..f284603 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_base.h @@ -0,0 +1,278 @@ +// Safe sequence/iterator base implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_base.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_BASE_H +#define _GLIBCXX_DEBUG_SAFE_BASE_H 1 + +#include + +namespace __gnu_debug +{ + class _Safe_sequence_base; + + /** \brief Basic functionality for a @a safe iterator. + * + * The %_Safe_iterator_base base class implements the functionality + * of a safe iterator that is not specific to a particular iterator + * type. It contains a pointer back to the sequence it references + * along with iterator version information and pointers to form a + * doubly-linked list of iterators referenced by the container. + * + * This class must not perform any operations that can throw an + * exception, or the exception guarantees of derived iterators will + * be broken. + */ + class _Safe_iterator_base + { + friend class _Safe_sequence_base; + + public: + /** The sequence this iterator references; may be NULL to indicate + a singular iterator. */ + _Safe_sequence_base* _M_sequence; + + /** The version number of this iterator. The sentinel value 0 is + * used to indicate an invalidated iterator (i.e., one that is + * singular because of an operation on the container). This + * version number must equal the version number in the sequence + * referenced by _M_sequence for the iterator to be + * non-singular. + */ + unsigned int _M_version; + + /** Pointer to the previous iterator in the sequence's list of + iterators. Only valid when _M_sequence != NULL. */ + _Safe_iterator_base* _M_prior; + + /** Pointer to the next iterator in the sequence's list of + iterators. Only valid when _M_sequence != NULL. */ + _Safe_iterator_base* _M_next; + + protected: + /** Initializes the iterator and makes it singular. */ + _Safe_iterator_base() + : _M_sequence(0), _M_version(0), _M_prior(0), _M_next(0) + { } + + /** Initialize the iterator to reference the sequence pointed to + * by @p __seq. @p __constant is true when we are initializing a + * constant iterator, and false if it is a mutable iterator. Note + * that @p __seq may be NULL, in which case the iterator will be + * singular. Otherwise, the iterator will reference @p __seq and + * be nonsingular. + */ + _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); } + + /** 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. */ + _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); } + + ~_Safe_iterator_base() { this->_M_detach(); } + + /** For use in _Safe_iterator. */ + __gnu_cxx::__mutex& + _M_get_mutex() throw (); + + /** Attaches this iterator to the given sequence, detaching it + * from whatever sequence it was attached to originally. If the + * new sequence is the NULL pointer, the iterator is left + * unattached. + */ + void + _M_attach(_Safe_sequence_base* __seq, bool __constant); + + /** Likewise, but not thread-safe. */ + void + _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw (); + + /** Detach the iterator for whatever sequence it is attached to, + * if any. + */ + void + _M_detach(); + + public: + /** Likewise, but not thread-safe. */ + void + _M_detach_single() throw (); + + /** Determines if we are attached to the given sequence. */ + bool + _M_attached_to(const _Safe_sequence_base* __seq) const + { return _M_sequence == __seq; } + + /** Is this iterator singular? */ + _GLIBCXX_PURE bool + _M_singular() const throw (); + + /** Can we compare this iterator to the given iterator @p __x? + Returns true if both iterators are nonsingular and reference + the same sequence. */ + _GLIBCXX_PURE bool + _M_can_compare(const _Safe_iterator_base& __x) const throw (); + + /** Invalidate the iterator, making it singular. */ + void + _M_invalidate() + { _M_version = 0; } + + /** Reset all member variables */ + void + _M_reset() throw (); + + /** Unlink itself */ + void + _M_unlink() throw () + { + if (_M_prior) + _M_prior->_M_next = _M_next; + if (_M_next) + _M_next->_M_prior = _M_prior; + } + }; + + /** Iterators that derive from _Safe_iterator_base can be determined singular + * or non-singular. + **/ + inline bool + __check_singular_aux(const _Safe_iterator_base* __x) + { return __x->_M_singular(); } + + /** + * @brief Base class that supports tracking of iterators that + * reference a sequence. + * + * The %_Safe_sequence_base class provides basic support for + * tracking iterators into a sequence. Sequences that track + * iterators must derived from %_Safe_sequence_base publicly, so + * that safe iterators (which inherit _Safe_iterator_base) can + * attach to them. This class contains two linked lists of + * iterators, one for constant iterators and one for mutable + * iterators, and a version number that allows very fast + * invalidation of all iterators that reference the container. + * + * This class must ensure that no operation on it may throw an + * exception, otherwise @a safe sequences may fail to provide the + * exception-safety guarantees required by the C++ standard. + */ + class _Safe_sequence_base + { + friend class _Safe_iterator_base; + + public: + /// The list of mutable iterators that reference this container + _Safe_iterator_base* _M_iterators; + + /// The list of constant iterators that reference this container + _Safe_iterator_base* _M_const_iterators; + + /// The container version number. This number may never be 0. + mutable unsigned int _M_version; + + protected: + // Initialize with a version number of 1 and no iterators + _Safe_sequence_base() _GLIBCXX_NOEXCEPT + : _M_iterators(0), _M_const_iterators(0), _M_version(1) + { } + +#if __cplusplus >= 201103L + _Safe_sequence_base(const _Safe_sequence_base&) noexcept + : _Safe_sequence_base() { } + + // Move constructor swap iterators. + _Safe_sequence_base(_Safe_sequence_base&& __seq) noexcept + : _Safe_sequence_base() + { _M_swap(__seq); } +#endif + + /** Notify all iterators that reference this sequence that the + sequence is being destroyed. */ + ~_Safe_sequence_base() + { this->_M_detach_all(); } + + /** Detach all iterators, leaving them singular. */ + void + _M_detach_all(); + + /** Detach all singular iterators. + * @post for all iterators i attached to this sequence, + * i->_M_version == _M_version. + */ + void + _M_detach_singular(); + + /** Revalidates all attached singular iterators. This method may + * be used to validate iterators that were invalidated before + * (but for some reason, such as an exception, need to become + * valid again). + */ + void + _M_revalidate_singular(); + + /** Swap this sequence with the given sequence. This operation + * also swaps ownership of the iterators, so that when the + * operation is complete all iterators that originally referenced + * one container now reference the other container. + */ + void + _M_swap(_Safe_sequence_base& __x) _GLIBCXX_USE_NOEXCEPT; + + /** For use in _Safe_sequence. */ + __gnu_cxx::__mutex& + _M_get_mutex() throw (); + + /** Invalidates all iterators. */ + void + _M_invalidate_all() const + { if (++_M_version == 0) _M_version = 1; } + + private: + /** Attach an iterator to this sequence. */ + void + _M_attach(_Safe_iterator_base* __it, bool __constant); + + /** Likewise but not thread safe. */ + void + _M_attach_single(_Safe_iterator_base* __it, bool __constant) throw (); + + /** Detach an iterator from this sequence */ + void + _M_detach(_Safe_iterator_base* __it); + + /** Likewise but not thread safe. */ + void + _M_detach_single(_Safe_iterator_base* __it) throw (); + }; +} // namespace __gnu_debug + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_container.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_container.h new file mode 100644 index 0000000..d9636c2 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_container.h @@ -0,0 +1,129 @@ +// Safe container implementation -*- C++ -*- + +// Copyright (C) 2014-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_container.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_CONTAINER_H +#define _GLIBCXX_DEBUG_SAFE_CONTAINER_H 1 + +#include + +namespace __gnu_debug +{ + /// Safe class dealing with some allocator dependent operations. + template class _SafeBase, + bool _IsCxx11AllocatorAware = true> + class _Safe_container + : public _SafeBase<_SafeContainer> + { + typedef _SafeBase<_SafeContainer> _Base; + + _SafeContainer& + _M_cont() _GLIBCXX_NOEXCEPT + { return *static_cast<_SafeContainer*>(this); } + + protected: + _Safe_container& + _M_safe() _GLIBCXX_NOEXCEPT + { return *this; } + +#if __cplusplus >= 201103L + _Safe_container() = default; + _Safe_container(const _Safe_container&) = default; + _Safe_container(_Safe_container&&) = default; + + _Safe_container(_Safe_container&& __x, const _Alloc& __a) + : _Safe_container() + { + if (__x._M_cont().get_allocator() == __a) + _Base::_M_swap(__x); + else + __x._M_invalidate_all(); + } +#endif + + public: + // Copy assignment invalidate all iterators. + _Safe_container& + operator=(const _Safe_container&) _GLIBCXX_NOEXCEPT + { + this->_M_invalidate_all(); + return *this; + } + +#if __cplusplus >= 201103L + _Safe_container& + operator=(_Safe_container&& __x) noexcept + { + if (std::__addressof(__x) == this) + { + // Standard containers have a valid but unspecified value after + // self-move, so we invalidate all debug iterators even if the + // underlying container happens to preserve its contents. + this->_M_invalidate_all(); + return *this; + } + + if (_IsCxx11AllocatorAware) + { + typedef __gnu_cxx::__alloc_traits<_Alloc> _Alloc_traits; + + bool __xfer_memory = _Alloc_traits::_S_propagate_on_move_assign() + || _M_cont().get_allocator() == __x._M_cont().get_allocator(); + if (__xfer_memory) + _Base::_M_swap(__x); + else + this->_M_invalidate_all(); + } + else + _Base::_M_swap(__x); + + __x._M_invalidate_all(); + return *this; + } + + void + _M_swap(_Safe_container& __x) noexcept + { + if (_IsCxx11AllocatorAware) + { + typedef __gnu_cxx::__alloc_traits<_Alloc> _Alloc_traits; + + if (!_Alloc_traits::_S_propagate_on_swap()) + __glibcxx_check_equal_allocs(this->_M_cont()._M_base(), + __x._M_cont()._M_base()); + } + + _Base::_M_swap(__x); + } +#endif + }; + +} // namespace __gnu_debug + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_iterator.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_iterator.h new file mode 100644 index 0000000..8e138fd --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_iterator.h @@ -0,0 +1,1001 @@ +// Safe iterator implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_iterator.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_H +#define _GLIBCXX_DEBUG_SAFE_ITERATOR_H 1 + +#include +#include +#include +#include +#include +#include +#if __cplusplus > 201703L +# include +#endif + +#define _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, _BadMsgId, _DiffMsgId) \ + _GLIBCXX_DEBUG_VERIFY(!_Lhs._M_singular() && !_Rhs._M_singular() \ + || (_Lhs.base() == _Iterator() \ + && _Rhs.base() == _Iterator()), \ + _M_message(_BadMsgId) \ + ._M_iterator(_Lhs, #_Lhs) \ + ._M_iterator(_Rhs, #_Rhs)); \ + _GLIBCXX_DEBUG_VERIFY(_Lhs._M_can_compare(_Rhs), \ + _M_message(_DiffMsgId) \ + ._M_iterator(_Lhs, #_Lhs) \ + ._M_iterator(_Rhs, #_Rhs)) + +#define _GLIBCXX_DEBUG_VERIFY_EQ_OPERANDS(_Lhs, _Rhs) \ + _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, __msg_iter_compare_bad, \ + __msg_compare_different) + +#define _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(_Lhs, _Rhs) \ + _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, __msg_iter_order_bad, \ + __msg_order_different) + +#define _GLIBCXX_DEBUG_VERIFY_DIST_OPERANDS(_Lhs, _Rhs) \ + _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs, __msg_distance_bad, \ + __msg_distance_different) + +namespace __gnu_debug +{ + /** Helper struct to deal with sequence offering a before_begin + * iterator. + **/ + template + struct _BeforeBeginHelper + { + template + static bool + _S_Is(const _Safe_iterator<_Iterator, _Sequence, _Category>&) + { return false; } + + template + static bool + _S_Is_Beginnest(const _Safe_iterator<_Iterator, _Sequence, _Category>& __it) + { return __it.base() == __it._M_get_sequence()->_M_base().begin(); } + }; + + /** Sequence traits giving the size of a container if possible. */ + template + struct _Sequence_traits + { + typedef _Distance_traits _DistTraits; + + static typename _DistTraits::__type + _S_size(const _Sequence& __seq) + { return std::make_pair(__seq.size(), __dp_exact); } + }; + + /** \brief Safe iterator wrapper. + * + * The class template %_Safe_iterator is a wrapper around an + * iterator that tracks the iterator's movement among sequences and + * checks that operations performed on the "safe" iterator are + * legal. In additional to the basic iterator operations (which are + * validated, and then passed to the underlying iterator), + * %_Safe_iterator has member functions for iterator invalidation, + * attaching/detaching the iterator from sequences, and querying + * the iterator's state. + * + * Note that _Iterator must be the first base class so that it gets + * initialized before the iterator is being attached to the container's list + * of iterators and it is being detached before _Iterator get + * destroyed. Otherwise it would result in a data race. + */ + template::iterator_category> + class _Safe_iterator + : private _Iterator, + public _Safe_iterator_base + { + typedef _Iterator _Iter_base; + typedef _Safe_iterator_base _Safe_base; + + typedef std::iterator_traits<_Iterator> _Traits; + + protected: + typedef std::__are_same _IsConstant; + + typedef typename __gnu_cxx::__conditional_type< + _IsConstant::__value, + typename _Sequence::_Base::iterator, + typename _Sequence::_Base::const_iterator>::__type _OtherIterator; + + struct _Attach_single + { }; + + _Safe_iterator(_Iterator __i, _Safe_sequence_base* __seq, _Attach_single) + _GLIBCXX_NOEXCEPT + : _Iter_base(__i) + { _M_attach_single(__seq); } + + public: + typedef _Iterator iterator_type; + typedef typename _Traits::iterator_category iterator_category; + typedef typename _Traits::value_type value_type; + typedef typename _Traits::difference_type difference_type; + typedef typename _Traits::reference reference; + typedef typename _Traits::pointer pointer; + +#if __cplusplus > 201703L && __cpp_lib_concepts + using iterator_concept = std::__detail::__iter_concept<_Iterator>; +#endif + + /// @post the iterator is singular and unattached + _Safe_iterator() _GLIBCXX_NOEXCEPT : _Iter_base() { } + + /** + * @brief Safe iterator construction from an unsafe iterator and + * its sequence. + * + * @pre @p seq is not NULL + * @post this is not singular + */ + _Safe_iterator(_Iterator __i, const _Safe_sequence_base* __seq) + _GLIBCXX_NOEXCEPT + : _Iter_base(__i), _Safe_base(__seq, _S_constant()) + { + _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), + _M_message(__msg_init_singular) + ._M_iterator(*this, "this")); + } + + /** + * @brief Copy construction. + */ + _Safe_iterator(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT + : _Iter_base(__x.base()), _Safe_base() + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_init_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _M_attach(__x._M_sequence); + } + +#if __cplusplus >= 201103L + /** + * @brief Move construction. + * @post __x is singular and unattached + */ + _Safe_iterator(_Safe_iterator&& __x) noexcept + : _Iter_base() + { + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_init_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _Safe_sequence_base* __seq = __x._M_sequence; + __x._M_detach(); + std::swap(base(), __x.base()); + _M_attach(__seq); + } +#endif + + /** + * @brief Converting constructor from a mutable iterator to a + * constant iterator. + */ + template + _Safe_iterator( + const _Safe_iterator<_MutableIterator, _Sequence, + typename __gnu_cxx::__enable_if<_IsConstant::__value && + std::__are_same<_MutableIterator, _OtherIterator>::__value, + _Category>::__type>& __x) + _GLIBCXX_NOEXCEPT + : _Iter_base(__x.base()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _MutableIterator(), + _M_message(__msg_init_const_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _M_attach(__x._M_sequence); + } + + /** + * @brief Copy assignment. + */ + _Safe_iterator& + operator=(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + + if (this->_M_sequence && this->_M_sequence == __x._M_sequence) + { + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + base() = __x.base(); + _M_version = __x._M_sequence->_M_version; + } + else + { + _M_detach(); + base() = __x.base(); + _M_attach(__x._M_sequence); + } + + return *this; + } + +#if __cplusplus >= 201103L + /** + * @brief Move assignment. + * @post __x is singular and unattached + */ + _Safe_iterator& + operator=(_Safe_iterator&& __x) noexcept + { + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + + if (std::__addressof(__x) == this) + return *this; + + if (this->_M_sequence && this->_M_sequence == __x._M_sequence) + { + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + base() = __x.base(); + _M_version = __x._M_sequence->_M_version; + } + else + { + _M_detach(); + base() = __x.base(); + _M_attach(__x._M_sequence); + } + + __x._M_detach(); + __x.base() = _Iterator(); + return *this; + } +#endif + + /** + * @brief Iterator dereference. + * @pre iterator is dereferenceable + */ + reference + operator*() const _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), + _M_message(__msg_bad_deref) + ._M_iterator(*this, "this")); + return *base(); + } + + /** + * @brief Iterator dereference. + * @pre iterator is dereferenceable + */ + pointer + operator->() const _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), + _M_message(__msg_bad_deref) + ._M_iterator(*this, "this")); + return base().operator->(); + } + + // ------ Input iterator requirements ------ + /** + * @brief Iterator preincrement + * @pre iterator is incrementable + */ + _Safe_iterator& + operator++() _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + ++base(); + return *this; + } + + /** + * @brief Iterator postincrement + * @pre iterator is incrementable + */ + _Safe_iterator + operator++(int) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + return _Safe_iterator(base()++, this->_M_sequence, _Attach_single()); + } + + // ------ Utilities ------ + + /// Determine if this is a constant iterator. + static _GLIBCXX_CONSTEXPR bool + _S_constant() + { return _IsConstant::__value; } + + /** + * @brief Return the underlying iterator + */ + _Iterator& + base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Iterator& + base() const _GLIBCXX_NOEXCEPT { return *this; } + + /** + * @brief Conversion to underlying non-debug iterator to allow + * better interaction with non-debug containers. + */ + operator _Iterator() const _GLIBCXX_NOEXCEPT { return *this; } + + /** Attach iterator to the given sequence. */ + void + _M_attach(_Safe_sequence_base* __seq) + { _Safe_base::_M_attach(__seq, _S_constant()); } + + /** Likewise, but not thread-safe. */ + void + _M_attach_single(_Safe_sequence_base* __seq) + { _Safe_base::_M_attach_single(__seq, _S_constant()); } + + /// Is the iterator dereferenceable? + bool + _M_dereferenceable() const + { return !this->_M_singular() && !_M_is_end() && !_M_is_before_begin(); } + + /// Is the iterator before a dereferenceable one? + bool + _M_before_dereferenceable() const + { + if (this->_M_incrementable()) + { + _Iterator __base = base(); + return ++__base != _M_get_sequence()->_M_base().end(); + } + return false; + } + + /// Is the iterator incrementable? + bool + _M_incrementable() const + { return !this->_M_singular() && !_M_is_end(); } + + // Can we advance the iterator @p __n steps (@p __n may be negative) + bool + _M_can_advance(difference_type __n, bool __strict = false) const; + + // Can we advance the iterator using @p __dist in @p __way direction. + template + bool + _M_can_advance(const std::pair<_Diff, _Distance_precision>& __dist, + int __way) const; + + // Is the iterator range [*this, __rhs) valid? + bool + _M_valid_range(const _Safe_iterator& __rhs, + std::pair& __dist, + bool __check_dereferenceable = true) const; + + // The sequence this iterator references. + typename __gnu_cxx::__conditional_type< + _IsConstant::__value, const _Sequence*, _Sequence*>::__type + _M_get_sequence() const + { return static_cast<_Sequence*>(_M_sequence); } + + // Get distance to __rhs. + typename _Distance_traits<_Iterator>::__type + _M_get_distance_to(const _Safe_iterator& __rhs) const; + + // Get distance from sequence begin up to *this. + typename _Distance_traits<_Iterator>::__type + _M_get_distance_from_begin() const; + + // Get distance from *this to sequence end. + typename _Distance_traits<_Iterator>::__type + _M_get_distance_to_end() const; + + /// Is this iterator equal to the sequence's begin() iterator? + bool + _M_is_begin() const + { return base() == _M_get_sequence()->_M_base().begin(); } + + /// Is this iterator equal to the sequence's end() iterator? + bool + _M_is_end() const + { return base() == _M_get_sequence()->_M_base().end(); } + + /// Is this iterator equal to the sequence's before_begin() iterator if + /// any? + bool + _M_is_before_begin() const + { return _BeforeBeginHelper<_Sequence>::_S_Is(*this); } + + /// Is this iterator equal to the sequence's before_begin() iterator if + /// any or begin() otherwise? + bool + _M_is_beginnest() const + { return _BeforeBeginHelper<_Sequence>::_S_Is_Beginnest(*this); } + + // ------ Operators ------ + + typedef _Safe_iterator<_Iterator, _Sequence, iterator_category> _Self; + + friend bool + operator==(const _Self& __lhs, const _Self& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_EQ_OPERANDS(__lhs, __rhs); + return __lhs.base() == __rhs.base(); + } + + template + friend bool + operator==(const _Self& __lhs, + const _Safe_iterator<_IteR, _Sequence, iterator_category>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_EQ_OPERANDS(__lhs, __rhs); + return __lhs.base() == __rhs.base(); + } + +#if ! __cpp_lib_three_way_comparison + friend bool + operator!=(const _Self& __lhs, const _Self& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_EQ_OPERANDS(__lhs, __rhs); + return __lhs.base() != __rhs.base(); + } + + template + friend bool + operator!=(const _Self& __lhs, + const _Safe_iterator<_IteR, _Sequence, iterator_category>& __rhs) + _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_EQ_OPERANDS(__lhs, __rhs); + return __lhs.base() != __rhs.base(); + } +#endif // three-way comparison + }; + + template + class _Safe_iterator<_Iterator, _Sequence, std::bidirectional_iterator_tag> + : public _Safe_iterator<_Iterator, _Sequence, std::forward_iterator_tag> + { + typedef _Safe_iterator<_Iterator, _Sequence, + std::forward_iterator_tag> _Safe_base; + + protected: + typedef typename _Safe_base::_OtherIterator _OtherIterator; + typedef typename _Safe_base::_Attach_single _Attach_single; + + _Safe_iterator(_Iterator __i, _Safe_sequence_base* __seq, _Attach_single) + _GLIBCXX_NOEXCEPT + : _Safe_base(__i, __seq, _Attach_single()) + { } + + public: + /// @post the iterator is singular and unattached + _Safe_iterator() _GLIBCXX_NOEXCEPT { } + + /** + * @brief Safe iterator construction from an unsafe iterator and + * its sequence. + * + * @pre @p seq is not NULL + * @post this is not singular + */ + _Safe_iterator(_Iterator __i, const _Safe_sequence_base* __seq) + _GLIBCXX_NOEXCEPT + : _Safe_base(__i, __seq) + { } + + /** + * @brief Copy construction. + */ + _Safe_iterator(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT + : _Safe_base(__x) + { } + +#if __cplusplus >= 201103L + /** @brief Move construction. */ + _Safe_iterator(_Safe_iterator&&) = default; +#endif + + /** + * @brief Converting constructor from a mutable iterator to a + * constant iterator. + */ + template + _Safe_iterator( + const _Safe_iterator<_MutableIterator, _Sequence, + typename __gnu_cxx::__enable_if<_Safe_base::_IsConstant::__value && + std::__are_same<_MutableIterator, _OtherIterator>::__value, + std::bidirectional_iterator_tag>::__type>& __x) + _GLIBCXX_NOEXCEPT + : _Safe_base(__x) + { } + +#if __cplusplus >= 201103L + /** @brief Copy assignment. */ + _Safe_iterator& + operator=(const _Safe_iterator&) = default; + + /** @brief Move assignment. */ + _Safe_iterator& + operator=(_Safe_iterator&&) = default; +#else + /** @brief Copy assignment. */ + _Safe_iterator& + operator=(const _Safe_iterator& __x) + { + _Safe_base::operator=(__x); + return *this; + } +#endif + + // ------ Input iterator requirements ------ + /** + * @brief Iterator preincrement + * @pre iterator is incrementable + */ + _Safe_iterator& + operator++() _GLIBCXX_NOEXCEPT + { + _Safe_base::operator++(); + return *this; + } + + /** + * @brief Iterator postincrement + * @pre iterator is incrementable + */ + _Safe_iterator + operator++(int) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + return _Safe_iterator(this->base()++, this->_M_sequence, + _Attach_single()); + } + + // ------ Bidirectional iterator requirements ------ + /** + * @brief Iterator predecrement + * @pre iterator is decrementable + */ + _Safe_iterator& + operator--() _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(), + _M_message(__msg_bad_dec) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + --this->base(); + return *this; + } + + /** + * @brief Iterator postdecrement + * @pre iterator is decrementable + */ + _Safe_iterator + operator--(int) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(), + _M_message(__msg_bad_dec) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + return _Safe_iterator(this->base()--, this->_M_sequence, + _Attach_single()); + } + + // ------ Utilities ------ + + // Is the iterator decrementable? + bool + _M_decrementable() const + { return !this->_M_singular() && !this->_M_is_begin(); } + }; + + template + class _Safe_iterator<_Iterator, _Sequence, std::random_access_iterator_tag> + : public _Safe_iterator<_Iterator, _Sequence, + std::bidirectional_iterator_tag> + { + typedef _Safe_iterator<_Iterator, _Sequence, + std::bidirectional_iterator_tag> _Safe_base; + typedef typename _Safe_base::_OtherIterator _OtherIterator; + + typedef typename _Safe_base::_Self _Self; + typedef _Safe_iterator<_OtherIterator, _Sequence, + std::random_access_iterator_tag> _OtherSelf; + + typedef typename _Safe_base::_Attach_single _Attach_single; + + _Safe_iterator(_Iterator __i, _Safe_sequence_base* __seq, _Attach_single) + _GLIBCXX_NOEXCEPT + : _Safe_base(__i, __seq, _Attach_single()) + { } + + public: + typedef typename _Safe_base::difference_type difference_type; + typedef typename _Safe_base::reference reference; + + /// @post the iterator is singular and unattached + _Safe_iterator() _GLIBCXX_NOEXCEPT { } + + /** + * @brief Safe iterator construction from an unsafe iterator and + * its sequence. + * + * @pre @p seq is not NULL + * @post this is not singular + */ + _Safe_iterator(_Iterator __i, const _Safe_sequence_base* __seq) + _GLIBCXX_NOEXCEPT + : _Safe_base(__i, __seq) + { } + + /** + * @brief Copy construction. + */ + _Safe_iterator(const _Safe_iterator& __x) _GLIBCXX_NOEXCEPT + : _Safe_base(__x) + { } + +#if __cplusplus >= 201103L + /** @brief Move construction. */ + _Safe_iterator(_Safe_iterator&&) = default; +#endif + + /** + * @brief Converting constructor from a mutable iterator to a + * constant iterator. + */ + template + _Safe_iterator( + const _Safe_iterator<_MutableIterator, _Sequence, + typename __gnu_cxx::__enable_if<_Safe_base::_IsConstant::__value && + std::__are_same<_MutableIterator, _OtherIterator>::__value, + std::random_access_iterator_tag>::__type>& __x) + _GLIBCXX_NOEXCEPT + : _Safe_base(__x) + { } + +#if __cplusplus >= 201103L + /** @brief Copy assignment. */ + _Safe_iterator& + operator=(const _Safe_iterator&) = default; + + /** @brief Move assignment. */ + _Safe_iterator& + operator=(_Safe_iterator&&) = default; +#else + /** @brief Copy assignment. */ + _Safe_iterator& + operator=(const _Safe_iterator& __x) + { + _Safe_base::operator=(__x); + return *this; + } +#endif + + // Is the iterator range [*this, __rhs) valid? + bool + _M_valid_range(const _Safe_iterator& __rhs, + std::pair& __dist) const; + + // ------ Input iterator requirements ------ + /** + * @brief Iterator preincrement + * @pre iterator is incrementable + */ + _Safe_iterator& + operator++() _GLIBCXX_NOEXCEPT + { + _Safe_base::operator++(); + return *this; + } + + /** + * @brief Iterator postincrement + * @pre iterator is incrementable + */ + _Safe_iterator + operator++(int) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + return _Safe_iterator(this->base()++, this->_M_sequence, + _Attach_single()); + } + + // ------ Bidirectional iterator requirements ------ + /** + * @brief Iterator predecrement + * @pre iterator is decrementable + */ + _Safe_iterator& + operator--() _GLIBCXX_NOEXCEPT + { + _Safe_base::operator--(); + return *this; + } + + /** + * @brief Iterator postdecrement + * @pre iterator is decrementable + */ + _Safe_iterator + operator--(int) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_decrementable(), + _M_message(__msg_bad_dec) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + return _Safe_iterator(this->base()--, this->_M_sequence, + _Attach_single()); + } + + // ------ Random access iterator requirements ------ + 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)); + return this->base()[__n]; + } + + _Safe_iterator& + operator+=(difference_type __n) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(__n), + _M_message(__msg_advance_oob) + ._M_iterator(*this)._M_integer(__n)); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + this->base() += __n; + return *this; + } + + _Safe_iterator& + operator-=(difference_type __n) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(this->_M_can_advance(-__n), + _M_message(__msg_retreat_oob) + ._M_iterator(*this)._M_integer(__n)); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + this->base() -= __n; + return *this; + } + +#if __cpp_lib_three_way_comparison + friend auto + operator<=>(const _Self& __lhs, const _Self& __rhs) noexcept + { + _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(__lhs, __rhs); + return __lhs.base() <=> __rhs.base(); + } + + friend auto + operator<=>(const _Self& __lhs, const _OtherSelf& __rhs) noexcept + { + _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(__lhs, __rhs); + return __lhs.base() <=> __rhs.base(); + } +#else + friend bool + operator<(const _Self& __lhs, const _Self& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(__lhs, __rhs); + return __lhs.base() < __rhs.base(); + } + + friend bool + operator<(const _Self& __lhs, const _OtherSelf& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(__lhs, __rhs); + return __lhs.base() < __rhs.base(); + } + + friend bool + operator<=(const _Self& __lhs, const _Self& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(__lhs, __rhs); + return __lhs.base() <= __rhs.base(); + } + + friend bool + operator<=(const _Self& __lhs, const _OtherSelf& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(__lhs, __rhs); + return __lhs.base() <= __rhs.base(); + } + + friend bool + operator>(const _Self& __lhs, const _Self& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(__lhs, __rhs); + return __lhs.base() > __rhs.base(); + } + + friend bool + operator>(const _Self& __lhs, const _OtherSelf& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(__lhs, __rhs); + return __lhs.base() > __rhs.base(); + } + + friend bool + operator>=(const _Self& __lhs, const _Self& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(__lhs, __rhs); + return __lhs.base() >= __rhs.base(); + } + + friend bool + operator>=(const _Self& __lhs, const _OtherSelf& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS(__lhs, __rhs); + return __lhs.base() >= __rhs.base(); + } +#endif // three-way comparison + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // According to the resolution of DR179 not only the various comparison + // operators but also operator- must accept mixed iterator/const_iterator + // parameters. + friend difference_type + operator-(const _Self& __lhs, const _OtherSelf& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_DIST_OPERANDS(__lhs, __rhs); + return __lhs.base() - __rhs.base(); + } + + friend difference_type + operator-(const _Self& __lhs, const _Self& __rhs) _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY_DIST_OPERANDS(__lhs, __rhs); + return __lhs.base() - __rhs.base(); + } + + 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)); + return _Safe_iterator(__x.base() + __n, __x._M_sequence); + } + + 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)); + return _Safe_iterator(__n + __x.base(), __x._M_sequence); + } + + 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)); + return _Safe_iterator(__x.base() - __n, __x._M_sequence); + } + }; + + /** Safe iterators know how to check if they form a valid range. */ + template + inline bool + __valid_range(const _Safe_iterator<_Iterator, _Sequence, + _Category>& __first, + const _Safe_iterator<_Iterator, _Sequence, + _Category>& __last, + typename _Distance_traits<_Iterator>::__type& __dist) + { return __first._M_valid_range(__last, __dist); } + + template + inline bool + __valid_range(const _Safe_iterator<_Iterator, _Sequence, + _Category>& __first, + const _Safe_iterator<_Iterator, _Sequence, + _Category>& __last) + { + typename _Distance_traits<_Iterator>::__type __dist; + return __first._M_valid_range(__last, __dist); + } + + template + inline bool + __can_advance(const _Safe_iterator<_Iterator, _Sequence, _Category>& __it, + _Size __n) + { return __it._M_can_advance(__n); } + + template + inline bool + __can_advance(const _Safe_iterator<_Iterator, _Sequence, _Category>& __it, + const std::pair<_Diff, _Distance_precision>& __dist, + int __way) + { return __it._M_can_advance(__dist, __way); } + + template + _Iterator + __base(const _Safe_iterator<_Iterator, _Sequence, + std::random_access_iterator_tag>& __it) + { return __it.base(); } + +#if __cplusplus < 201103L + template + struct _Unsafe_type<_Safe_iterator<_Iterator, _Sequence> > + { typedef _Iterator _Type; }; +#endif + + template + inline _Iterator + __unsafe(const _Safe_iterator<_Iterator, _Sequence>& __it) + { return __it.base(); } + +} // namespace __gnu_debug + +#undef _GLIBCXX_DEBUG_VERIFY_DIST_OPERANDS +#undef _GLIBCXX_DEBUG_VERIFY_REL_OPERANDS +#undef _GLIBCXX_DEBUG_VERIFY_EQ_OPERANDS +#undef _GLIBCXX_DEBUG_VERIFY_OPERANDS + +#include + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_iterator.tcc b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_iterator.tcc new file mode 100644 index 0000000..05c379c --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_iterator.tcc @@ -0,0 +1,551 @@ +// Debugging iterator implementation (out of line) -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_iterator.tcc + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC +#define _GLIBCXX_DEBUG_SAFE_ITERATOR_TCC 1 + +#include + +namespace __gnu_debug +{ + template + typename _Distance_traits<_Iterator>::__type + _Safe_iterator<_Iterator, _Sequence, _Category>:: + _M_get_distance_from_begin() const + { + typedef _Sequence_traits<_Sequence> _SeqTraits; + + // No need to consider before_begin as this function is only used in + // _M_can_advance which won't be used for forward_list iterators. + if (_M_is_begin()) + return std::make_pair(0, __dp_exact); + + if (_M_is_end()) + return _SeqTraits::_S_size(*_M_get_sequence()); + + typename _Distance_traits<_Iterator>::__type __res + = __get_distance(_M_get_sequence()->_M_base().begin(), base()); + + if (__res.second == __dp_equality) + return std::make_pair(1, __dp_sign); + + return __res; + } + + template + typename _Distance_traits<_Iterator>::__type + _Safe_iterator<_Iterator, _Sequence, _Category>:: + _M_get_distance_to_end() const + { + typedef _Sequence_traits<_Sequence> _SeqTraits; + + // No need to consider before_begin as this function is only used in + // _M_can_advance which won't be used for forward_list iterators. + if (_M_is_begin()) + return _SeqTraits::_S_size(*_M_get_sequence()); + + if (_M_is_end()) + return std::make_pair(0, __dp_exact); + + typename _Distance_traits<_Iterator>::__type __res + = __get_distance(base(), _M_get_sequence()->_M_base().end()); + + if (__res.second == __dp_equality) + return std::make_pair(1, __dp_sign); + + return __res; + } + + template + bool + _Safe_iterator<_Iterator, _Sequence, _Category>:: + _M_can_advance(difference_type __n, bool __strict) const + { + if (this->_M_singular()) + return false; + + if (__n == 0) + return true; + + std::pair __dist = __n < 0 + ? _M_get_distance_from_begin() + : _M_get_distance_to_end(); + + if (__n < 0) + __n = -__n; + + return __dist.second > __dp_sign + ? __dist.first >= __n + : !__strict && __dist.first > 0; + } + + template + template + bool + _Safe_iterator<_Iterator, _Sequence, _Category>:: + _M_can_advance(const std::pair<_Diff, _Distance_precision>& __dist, + int __way) const + { + return __dist.second == __dp_exact + ? _M_can_advance(__way * __dist.first) + : _M_can_advance(__way * (__dist.first == 0 + ? 0 + : __dist.first < 0 ? -1 : 1)); + } + + template + typename _Distance_traits<_Iterator>::__type + _Safe_iterator<_Iterator, _Sequence, _Category>:: + _M_get_distance_to(const _Safe_iterator& __rhs) const + { + typedef typename _Distance_traits<_Iterator>::__type _Dist; + typedef _Sequence_traits<_Sequence> _SeqTraits; + + _Dist __base_dist = __get_distance(this->base(), __rhs.base()); + if (__base_dist.second == __dp_exact) + return __base_dist; + + _Dist __seq_dist = _SeqTraits::_S_size(*this->_M_get_sequence()); + if (this->_M_is_before_begin()) + { + if (__rhs._M_is_begin()) + return std::make_pair(1, __dp_exact); + + return __seq_dist.second == __dp_exact + ? std::make_pair(__seq_dist.first + 1, __dp_exact) + : __seq_dist; + } + + if (this->_M_is_begin()) + { + if (__rhs._M_is_before_begin()) + return std::make_pair(-1, __dp_exact); + + if (__rhs._M_is_end()) + return __seq_dist; + + return std::make_pair(__seq_dist.first, + __seq_dist.second == __dp_exact + ? __dp_sign_max_size : __seq_dist.second); + } + + if (this->_M_is_end()) + { + if (__rhs._M_is_before_begin()) + return __seq_dist.second == __dp_exact + ? std::make_pair(-__seq_dist.first - 1, __dp_exact) + : std::make_pair(-__seq_dist.first, __dp_sign); + + if (__rhs._M_is_begin()) + return std::make_pair(-__seq_dist.first, __seq_dist.second); + + return std::make_pair(-__seq_dist.first, + __seq_dist.second == __dp_exact + ? __dp_sign_max_size : __seq_dist.second); + } + + if (__rhs._M_is_before_begin()) + return __seq_dist.second == __dp_exact + ? std::make_pair(__seq_dist.first - 1, __dp_exact) + : std::make_pair(-__seq_dist.first, __dp_sign); + + if (__rhs._M_is_begin()) + return std::make_pair(-__seq_dist.first, + __seq_dist.second == __dp_exact + ? __dp_sign_max_size : __seq_dist.second); + + if (__rhs._M_is_end()) + return std::make_pair(__seq_dist.first, + __seq_dist.second == __dp_exact + ? __dp_sign_max_size : __seq_dist.second); + + return std::make_pair(1, __dp_equality); + } + + template + bool + _Safe_iterator<_Iterator, _Sequence, _Category>:: + _M_valid_range(const _Safe_iterator& __rhs, + std::pair& __dist, + bool __check_dereferenceable) const + { + if (_M_singular() || __rhs._M_singular() || !_M_can_compare(__rhs)) + return false; + + /* Determine iterators order */ + __dist = _M_get_distance_to(__rhs); + if (__dist.second != __dp_equality) + { + // If range is not empty first iterator must be dereferenceable. + return __dist.first == 0 + || (__dist.first > 0 + && (!__check_dereferenceable || _M_dereferenceable())); + } + + // Assume that this is a valid range; we can't check anything else. + return true; + } + + template + bool + _Safe_iterator<_Iterator, _Sequence, std::random_access_iterator_tag>:: + _M_valid_range(const _Safe_iterator& __rhs, + std::pair& __dist) const + { + if (this->_M_singular() || __rhs._M_singular() + || !this->_M_can_compare(__rhs)) + return false; + + /* Determine iterators order */ + __dist = std::make_pair(__rhs.base() - this->base(), __dp_exact); + + // If range is not empty first iterator must be dereferenceable. + return __dist.first == 0 + || (__dist.first > 0 && this->_M_dereferenceable()); + } +} // namespace __gnu_debug + +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template + _Ite + __niter_base(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, + std::random_access_iterator_tag>& __it) + { return __it.base(); } + + template + _OI + __copy_move_a( + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first, + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __last, + _OI __result) + { + typename ::__gnu_debug::_Distance_traits<_Ite>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + __glibcxx_check_can_increment_dist(__result, __dist, 1); + + if (__dist.second > ::__gnu_debug::__dp_equality) + return std::__copy_move_a<_IsMove>(__first.base(), __last.base(), + __result); + + return std::__copy_move_a1<_IsMove>(__first, __last, __result); + } + + template + __gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat> + __copy_move_a(_II __first, _II __last, + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __result) + { + typename ::__gnu_debug::_Distance_traits<_II>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + __glibcxx_check_can_increment_dist(__result, __dist, 1); + + if (__dist.second > ::__gnu_debug::__dp_sign + && __result._M_can_advance(__dist.first, true)) + return ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>( + std::__copy_move_a<_IsMove>(__first, __last, __result.base()), + __result._M_sequence); + + return std::__copy_move_a1<_IsMove>(__first, __last, __result); + } + + template + ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat> + __copy_move_a( + const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>& __first, + const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>& __last, + const ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>& __result) + { + typename ::__gnu_debug::_Distance_traits<_IIte>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + __glibcxx_check_can_increment_dist(__result, __dist, 1); + + if (__dist.second > ::__gnu_debug::__dp_equality) + { + if (__dist.second > ::__gnu_debug::__dp_sign + && __result._M_can_advance(__dist.first, true)) + return ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>( + std::__copy_move_a<_IsMove>(__first.base(), __last.base(), + __result.base()), + __result._M_sequence); + + return std::__copy_move_a<_IsMove>(__first.base(), __last.base(), + __result); + } + + return std::__copy_move_a1<_IsMove>(__first, __last, __result); + } + + template + _OI + __copy_move_backward_a( + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first, + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __last, + _OI __result) + { + typename ::__gnu_debug::_Distance_traits<_Ite>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + __glibcxx_check_can_increment_dist(__result, __dist, -1); + + if (__dist.second > ::__gnu_debug::__dp_equality) + return std::__copy_move_backward_a<_IsMove>( + __first.base(), __last.base(), __result); + + return std::__copy_move_backward_a1<_IsMove>(__first, __last, __result); + } + + template + __gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat> + __copy_move_backward_a(_II __first, _II __last, + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __result) + { + typename ::__gnu_debug::_Distance_traits<_II>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + __glibcxx_check_can_increment_dist(__result, __dist, -1); + + if (__dist.second > ::__gnu_debug::__dp_sign + && __result._M_can_advance(-__dist.first, true)) + return ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>( + std::__copy_move_backward_a<_IsMove>(__first, __last, + __result.base()), + __result._M_sequence); + + return std::__copy_move_backward_a1<_IsMove>(__first, __last, __result); + } + + template + ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat> + __copy_move_backward_a( + const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>& __first, + const ::__gnu_debug::_Safe_iterator<_IIte, _ISeq, _ICat>& __last, + const ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>& __result) + { + typename ::__gnu_debug::_Distance_traits<_IIte>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + __glibcxx_check_can_increment_dist(__result, __dist, -1); + + if (__dist.second > ::__gnu_debug::__dp_equality) + { + if (__dist.second > ::__gnu_debug::__dp_sign + && __result._M_can_advance(-__dist.first, true)) + return ::__gnu_debug::_Safe_iterator<_OIte, _OSeq, _OCat>( + std::__copy_move_backward_a<_IsMove>(__first.base(), __last.base(), + __result.base()), + __result._M_sequence); + + return std::__copy_move_backward_a<_IsMove>( + __first.base(), __last.base(), __result); + } + + return std::__copy_move_backward_a1<_IsMove>(__first, __last, __result); + } + + template + void + __fill_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first, + const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __last, + const _Tp& __value) + { + typename ::__gnu_debug::_Distance_traits<_Ite>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second > ::__gnu_debug::__dp_equality) + std::__fill_a(__first.base(), __last.base(), __value); + + std::__fill_a1(__first, __last, __value); + } + + template + ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat> + __fill_n_a(const ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>& __first, + _Size __n, const _Tp& __value, + std::input_iterator_tag) + { +#if __cplusplus >= 201103L + static_assert(is_integral<_Size>{}, "fill_n must pass integral size"); +#endif + + if (__n <= 0) + return __first; + + __glibcxx_check_can_increment(__first, __n); + if (__first._M_can_advance(__n, true)) + return ::__gnu_debug::_Safe_iterator<_Ite, _Seq, _Cat>( + std::__fill_n_a(__first.base(), __n, __value, _Cat()), + __first._M_sequence); + + return std::__fill_n_a1(__first, __n, __value); + } + + template + bool + __equal_aux( + const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>& __first1, + const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>& __last1, + _II2 __first2) + { + typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist; + __glibcxx_check_valid_range2(__first1, __last1, __dist); + __glibcxx_check_can_increment_dist(__first2, __dist, 1); + + if (__dist.second > ::__gnu_debug::__dp_equality) + return std::__equal_aux(__first1.base(), __last1.base(), __first2); + + return std::__equal_aux1(__first1, __last1, __first2); + } + + template + bool + __equal_aux(_II1 __first1, _II1 __last1, + const ::__gnu_debug::_Safe_iterator<_II2, _Seq2, _Cat2>& __first2) + { + typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist; + __glibcxx_check_valid_range2(__first1, __last1, __dist); + __glibcxx_check_can_increment_dist(__first2, __dist, 1); + + if (__dist.second > ::__gnu_debug::__dp_sign + && __first2._M_can_advance(__dist.first, true)) + return std::__equal_aux(__first1, __last1, __first2.base()); + + return std::__equal_aux1(__first1, __last1, __first2); + } + + template + bool + __equal_aux( + const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>& __first1, + const ::__gnu_debug::_Safe_iterator<_II1, _Seq1, _Cat1>& __last1, + const ::__gnu_debug::_Safe_iterator<_II2, _Seq2, _Cat2>& __first2) + { + typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist; + __glibcxx_check_valid_range2(__first1, __last1, __dist); + __glibcxx_check_can_increment_dist(__first2, __dist, 1); + + if (__dist.second > ::__gnu_debug::__dp_equality) + { + if (__dist.second > ::__gnu_debug::__dp_sign && + __first2._M_can_advance(__dist.first, true)) + return std::__equal_aux(__first1.base(), __last1.base(), + __first2.base()); + return std::__equal_aux(__first1.base(), __last1.base(), __first2); + } + + return __equal_aux1(__first1, __last1, __first2); + } + + template + bool + __lexicographical_compare_aux( + const ::__gnu_debug::_Safe_iterator<_Ite1, _Seq1, _Cat1>& __first1, + const ::__gnu_debug::_Safe_iterator<_Ite1, _Seq1, _Cat1>& __last1, + _II2 __first2, _II2 __last2) + { + typename ::__gnu_debug::_Distance_traits<_Ite1>::__type __dist1; + __glibcxx_check_valid_range2(__first1, __last1, __dist1); + __glibcxx_check_valid_range(__first2, __last2); + + if (__dist1.second > ::__gnu_debug::__dp_equality) + return std::__lexicographical_compare_aux(__first1.base(), + __last1.base(), + __first2, __last2); + return std::__lexicographical_compare_aux1(__first1, __last1, + __first2, __last2); + } + + template + bool + __lexicographical_compare_aux( + _II1 __first1, _II1 __last1, + const ::__gnu_debug::_Safe_iterator<_Ite2, _Seq2, _Cat2>& __first2, + const ::__gnu_debug::_Safe_iterator<_Ite2, _Seq2, _Cat2>& __last2) + { + __glibcxx_check_valid_range(__first1, __last1); + typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist2; + __glibcxx_check_valid_range2(__first2, __last2, __dist2); + + if (__dist2.second > ::__gnu_debug::__dp_equality) + return std::__lexicographical_compare_aux(__first1, __last1, + __first2.base(), + __last2.base()); + return std::__lexicographical_compare_aux1(__first1, __last1, + __first2, __last2); + } + + template + bool + __lexicographical_compare_aux( + const ::__gnu_debug::_Safe_iterator<_Ite1, _Seq1, _Cat1>& __first1, + const ::__gnu_debug::_Safe_iterator<_Ite1, _Seq1, _Cat1>& __last1, + const ::__gnu_debug::_Safe_iterator<_Ite2, _Seq2, _Cat2>& __first2, + const ::__gnu_debug::_Safe_iterator<_Ite2, _Seq2, _Cat2>& __last2) + { + typename ::__gnu_debug::_Distance_traits<_Ite1>::__type __dist1; + __glibcxx_check_valid_range2(__first1, __last1, __dist1); + typename ::__gnu_debug::_Distance_traits<_Ite2>::__type __dist2; + __glibcxx_check_valid_range2(__first2, __last2, __dist2); + + if (__dist1.second > ::__gnu_debug::__dp_equality) + { + if (__dist2.second > ::__gnu_debug::__dp_equality) + return std::__lexicographical_compare_aux(__first1.base(), + __last1.base(), + __first2.base(), + __last2.base()); + return std::__lexicographical_compare_aux(__first1.base(), + __last1.base(), + __first2, __last2); + } + + if (__dist2.second > ::__gnu_debug::__dp_equality) + return std::__lexicographical_compare_aux(__first1, __last1, + __first2.base(), + __last2.base()); + return std::__lexicographical_compare_aux1(__first1, __last1, + __first2, __last2); + } + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_local_iterator.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_local_iterator.h new file mode 100644 index 0000000..31c48e6 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_local_iterator.h @@ -0,0 +1,440 @@ +// Safe iterator implementation -*- C++ -*- + +// Copyright (C) 2011-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_local_iterator.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_H +#define _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_H 1 + +#include + +#define _GLIBCXX_DEBUG_VERIFY_OPERANDS(_Lhs, _Rhs) \ + _GLIBCXX_DEBUG_VERIFY(!_Lhs._M_singular() && !_Rhs._M_singular() \ + || (_Lhs.base() == _Iterator{} \ + && _Rhs.base() == _Iterator{}), \ + _M_message(__msg_iter_compare_bad) \ + ._M_iterator(_Lhs, "lhs") \ + ._M_iterator(_Rhs, "rhs")); \ + _GLIBCXX_DEBUG_VERIFY(_Lhs._M_can_compare(_Rhs), \ + _M_message(__msg_compare_different) \ + ._M_iterator(_Lhs, "lhs") \ + ._M_iterator(_Rhs, "rhs")); \ + _GLIBCXX_DEBUG_VERIFY(_Lhs._M_in_same_bucket(_Rhs), \ + _M_message(__msg_local_iter_compare_bad) \ + ._M_iterator(_Lhs, "lhs") \ + ._M_iterator(_Rhs, "rhs")) + +namespace __gnu_debug +{ + /** \brief Safe iterator wrapper. + * + * The class template %_Safe_local_iterator is a wrapper around an + * iterator that tracks the iterator's movement among sequences and + * checks that operations performed on the "safe" iterator are + * legal. In additional to the basic iterator operations (which are + * validated, and then passed to the underlying iterator), + * %_Safe_local_iterator has member functions for iterator invalidation, + * attaching/detaching the iterator from sequences, and querying + * the iterator's state. + */ + template + class _Safe_local_iterator + : private _Iterator + , public _Safe_local_iterator_base + { + typedef _Iterator _Iter_base; + typedef _Safe_local_iterator_base _Safe_base; + + typedef typename _Sequence::size_type size_type; + + typedef std::iterator_traits<_Iterator> _Traits; + + typedef std::__are_same< + typename _Sequence::_Base::const_local_iterator, + _Iterator> _IsConstant; + + typedef typename __gnu_cxx::__conditional_type<_IsConstant::__value, + typename _Sequence::_Base::local_iterator, + typename _Sequence::_Base::const_local_iterator>::__type + _OtherIterator; + + typedef _Safe_local_iterator _Self; + typedef _Safe_local_iterator<_OtherIterator, _Sequence> _OtherSelf; + + struct _Attach_single + { }; + + _Safe_local_iterator(_Iterator __i, _Safe_sequence_base* __cont, + _Attach_single) noexcept + : _Iter_base(__i) + { _M_attach_single(__cont); } + + public: + typedef _Iterator iterator_type; + typedef typename _Traits::iterator_category iterator_category; + typedef typename _Traits::value_type value_type; + typedef typename _Traits::difference_type difference_type; + typedef typename _Traits::reference reference; + typedef typename _Traits::pointer pointer; + + /// @post the iterator is singular and unattached + _Safe_local_iterator() noexcept : _Iter_base() { } + + /** + * @brief Safe iterator construction from an unsafe iterator and + * its sequence. + * + * @pre @p seq is not NULL + * @post this is not singular + */ + _Safe_local_iterator(_Iterator __i, const _Safe_sequence_base* __cont) + : _Iter_base(__i), _Safe_base(__cont, _S_constant()) + { + _GLIBCXX_DEBUG_VERIFY(!this->_M_singular(), + _M_message(__msg_init_singular) + ._M_iterator(*this, "this")); + } + + /** + * @brief Copy construction. + */ + _Safe_local_iterator(const _Safe_local_iterator& __x) noexcept + : _Iter_base(__x.base()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_init_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _M_attach(__x._M_sequence); + } + + /** + * @brief Move construction. + * @post __x is singular and unattached + */ + _Safe_local_iterator(_Safe_local_iterator&& __x) noexcept + : _Iter_base() + { + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_init_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + auto __cont = __x._M_sequence; + __x._M_detach(); + std::swap(base(), __x.base()); + _M_attach(__cont); + } + + /** + * @brief Converting constructor from a mutable iterator to a + * constant iterator. + */ + template + _Safe_local_iterator( + const _Safe_local_iterator<_MutableIterator, + typename __gnu_cxx::__enable_if<_IsConstant::__value && + std::__are_same<_MutableIterator, _OtherIterator>::__value, + _Sequence>::__type>& __x) noexcept + : _Iter_base(__x.base()) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _MutableIterator(), + _M_message(__msg_init_const_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + _M_attach(__x._M_sequence); + } + + /** + * @brief Copy assignment. + */ + _Safe_local_iterator& + operator=(const _Safe_local_iterator& __x) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 408. Is vector > forbidden? + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + + if (this->_M_sequence && this->_M_sequence == __x._M_sequence) + { + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + base() = __x.base(); + _M_version = __x._M_sequence->_M_version; + } + else + { + _M_detach(); + base() = __x.base(); + _M_attach(__x._M_sequence); + } + + return *this; + } + + /** + * @brief Move assignment. + * @post __x is singular and unattached + */ + _Safe_local_iterator& + operator=(_Safe_local_iterator&& __x) noexcept + { + _GLIBCXX_DEBUG_VERIFY(!__x._M_singular() + || __x.base() == _Iterator(), + _M_message(__msg_copy_singular) + ._M_iterator(*this, "this") + ._M_iterator(__x, "other")); + + if (std::__addressof(__x) == this) + return *this; + + if (this->_M_sequence && this->_M_sequence == __x._M_sequence) + { + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + base() = __x.base(); + _M_version = __x._M_sequence->_M_version; + } + else + { + _M_detach(); + base() = __x.base(); + _M_attach(__x._M_sequence); + } + + __x._M_detach(); + __x.base() = _Iterator(); + return *this; + } + + /** + * @brief Iterator dereference. + * @pre iterator is dereferenceable + */ + reference + operator*() const + { + _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), + _M_message(__msg_bad_deref) + ._M_iterator(*this, "this")); + return *base(); + } + + /** + * @brief Iterator dereference. + * @pre iterator is dereferenceable + */ + pointer + operator->() const + { + _GLIBCXX_DEBUG_VERIFY(this->_M_dereferenceable(), + _M_message(__msg_bad_deref) + ._M_iterator(*this, "this")); + return base().operator->(); + } + + // ------ Input iterator requirements ------ + /** + * @brief Iterator preincrement + * @pre iterator is incrementable + */ + _Safe_local_iterator& + operator++() + { + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + ++base(); + return *this; + } + + /** + * @brief Iterator postincrement + * @pre iterator is incrementable + */ + _Safe_local_iterator + operator++(int) + { + _GLIBCXX_DEBUG_VERIFY(this->_M_incrementable(), + _M_message(__msg_bad_inc) + ._M_iterator(*this, "this")); + __gnu_cxx::__scoped_lock __l(this->_M_get_mutex()); + return _Safe_local_iterator(base()++, this->_M_sequence, + _Attach_single()); + } + + // ------ Utilities ------ + + /// Determine if this is a constant iterator. + static constexpr bool + _S_constant() + { return _IsConstant::__value; } + + /** + * @brief Return the underlying iterator + */ + _Iterator& + base() noexcept { return *this; } + + const _Iterator& + base() const noexcept { return *this; } + + /** + * @brief Return the bucket + */ + size_type + bucket() const { return base()._M_get_bucket(); } + + /** + * @brief Conversion to underlying non-debug iterator to allow + * better interaction with non-debug containers. + */ + operator _Iterator() const { return *this; } + + /** Attach iterator to the given sequence. */ + void + _M_attach(_Safe_sequence_base* __seq) + { _Safe_base::_M_attach(__seq, _S_constant()); } + + /** Likewise, but not thread-safe. */ + void + _M_attach_single(_Safe_sequence_base* __seq) + { _Safe_base::_M_attach_single(__seq, _S_constant()); } + + /// Is the iterator dereferenceable? + bool + _M_dereferenceable() const + { return !this->_M_singular() && !_M_is_end(); } + + /// Is the iterator incrementable? + bool + _M_incrementable() const + { return !this->_M_singular() && !_M_is_end(); } + + // Is the iterator range [*this, __rhs) valid? + bool + _M_valid_range(const _Safe_local_iterator& __rhs, + std::pair& __dist_info) const; + + // Get distance to __rhs. + typename _Distance_traits<_Iterator>::__type + _M_get_distance_to(const _Safe_local_iterator& __rhs) const; + + // The sequence this iterator references. + typename __gnu_cxx::__conditional_type< + _IsConstant::__value, const _Sequence*, _Sequence*>::__type + _M_get_sequence() const + { return static_cast<_Sequence*>(_M_sequence); } + + /// Is this iterator equal to the sequence's begin(bucket) iterator? + bool _M_is_begin() const + { return base() == _M_get_sequence()->_M_base().begin(bucket()); } + + /// Is this iterator equal to the sequence's end(bucket) iterator? + bool _M_is_end() const + { return base() == _M_get_sequence()->_M_base().end(bucket()); } + + /// Is this iterator part of the same bucket as the other one? + template + bool + _M_in_same_bucket(const _Safe_local_iterator<_Other, + _Sequence>& __other) const + { return bucket() == __other.bucket(); } + + friend inline bool + operator==(const _Self& __lhs, const _OtherSelf& __rhs) noexcept + { + _GLIBCXX_DEBUG_VERIFY_OPERANDS(__lhs, __rhs); + return __lhs.base() == __rhs.base(); + } + + friend inline bool + operator==(const _Self& __lhs, const _Self& __rhs) noexcept + { + _GLIBCXX_DEBUG_VERIFY_OPERANDS(__lhs, __rhs); + return __lhs.base() == __rhs.base(); + } + + friend inline bool + operator!=(const _Self& __lhs, const _OtherSelf& __rhs) noexcept + { + _GLIBCXX_DEBUG_VERIFY_OPERANDS(__lhs, __rhs); + return __lhs.base() != __rhs.base(); + } + + friend inline bool + operator!=(const _Self& __lhs, const _Self& __rhs) noexcept + { + _GLIBCXX_DEBUG_VERIFY_OPERANDS(__lhs, __rhs); + return __lhs.base() != __rhs.base(); + } + }; + + /** Safe local iterators know how to check if they form a valid range. */ + template + inline bool + __valid_range(const _Safe_local_iterator<_Iterator, _Sequence>& __first, + const _Safe_local_iterator<_Iterator, _Sequence>& __last, + typename _Distance_traits<_Iterator>::__type& __dist_info) + { return __first._M_valid_range(__last, __dist_info); } + + template + inline bool + __valid_range(const _Safe_local_iterator<_Iterator, _Sequence>& __first, + const _Safe_local_iterator<_Iterator, _Sequence>& __last) + { + typename _Distance_traits<_Iterator>::__type __dist_info; + return __first._M_valid_range(__last, __dist_info); + } + +#if __cplusplus < 201103L + template + struct _Unsafe_type<_Safe_local_iterator<_Iterator, _Sequence> > + { typedef _Iterator _Type; }; +#endif + + template + inline _Iterator + __unsafe(const _Safe_local_iterator<_Iterator, _Sequence>& __it) + { return __it.base(); } + +} // namespace __gnu_debug + +#undef _GLIBCXX_DEBUG_VERIFY_OPERANDS + +#include + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_local_iterator.tcc b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_local_iterator.tcc new file mode 100644 index 0000000..db9e4b5 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_local_iterator.tcc @@ -0,0 +1,107 @@ +// Debugging iterator implementation (out of line) -*- C++ -*- + +// Copyright (C) 2011-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_local_iterator.tcc + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_TCC +#define _GLIBCXX_DEBUG_SAFE_LOCAL_ITERATOR_TCC 1 + +namespace __gnu_debug +{ + template + typename _Distance_traits<_Iterator>::__type + _Safe_local_iterator<_Iterator, _Sequence>:: + _M_get_distance_to(const _Safe_local_iterator& __rhs) const + { + if (base() == __rhs.base()) + return { 0, __dp_exact }; + + if (_M_is_begin()) + { + if (__rhs._M_is_end()) + return + { + _M_get_sequence()->bucket_size(bucket()), + __dp_exact + }; + + return { 1, __dp_sign }; + } + + if (_M_is_end()) + { + if (__rhs._M_is_begin()) + return + { + -_M_get_sequence()->bucket_size(bucket()), + __dp_exact + }; + + return { -1, __dp_sign }; + } + + if (__rhs._M_is_begin()) + return { -1, __dp_sign }; + + if (__rhs._M_is_end()) + return { 1, __dp_sign }; + + return { 1, __dp_equality }; + } + + template + bool + _Safe_local_iterator<_Iterator, _Sequence>:: + _M_valid_range(const _Safe_local_iterator& __rhs, + std::pair& __dist) const + { + if (!_M_can_compare(__rhs)) + return false; + + if (bucket() != __rhs.bucket()) + return false; + + /* Determine if we can order the iterators without the help of + the container */ + __dist = _M_get_distance_to(__rhs); + switch (__dist.second) + { + case __dp_equality: + if (__dist.first == 0) + return true; + break; + + case __dp_sign: + case __dp_exact: + return __dist.first >= 0; + } + + // Assume that this is a valid range; we can't check anything else + return true; + } +} // namespace __gnu_debug + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_sequence.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_sequence.h new file mode 100644 index 0000000..afdf354 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_sequence.h @@ -0,0 +1,150 @@ +// Safe sequence implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_sequence.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_H +#define _GLIBCXX_DEBUG_SAFE_SEQUENCE_H 1 + +#include +#include +#include +#include + +namespace __gnu_debug +{ + /** A simple function object that returns true if the passed-in + * value is not equal to the stored value. It saves typing over + * using both bind1st and not_equal. + */ + template + class _Not_equal_to + { + _Type __value; + + public: + explicit _Not_equal_to(const _Type& __v) : __value(__v) { } + + bool + operator()(const _Type& __x) const + { return __value != __x; } + }; + + /** A simple function object that returns true if the passed-in + * value is equal to the stored value. */ + template + class _Equal_to + { + _Type __value; + + public: + explicit _Equal_to(const _Type& __v) : __value(__v) { } + + bool + operator()(const _Type& __x) const + { return __value == __x; } + }; + + /** A function object that returns true when the given random access + iterator is at least @c n steps away from the given iterator. */ + template + class _After_nth_from + { + typedef typename std::iterator_traits<_Iterator>::difference_type + difference_type; + + _Iterator _M_base; + difference_type _M_n; + + public: + _After_nth_from(const difference_type& __n, const _Iterator& __base) + : _M_base(__base), _M_n(__n) { } + + bool + operator()(const _Iterator& __x) const + { return __x - _M_base >= _M_n; } + }; + + /** + * @brief Base class for constructing a @a safe sequence type that + * tracks iterators that reference it. + * + * The class template %_Safe_sequence simplifies the construction of + * @a safe sequences that track the iterators that reference the + * sequence, so that the iterators are notified of changes in the + * sequence that may affect their operation, e.g., if the container + * invalidates its iterators or is destructed. This class template + * may only be used by deriving from it and passing the name of the + * derived class as its template parameter via the curiously + * recurring template pattern. The derived class must have @c + * iterator and @c const_iterator types that are instantiations of + * class template _Safe_iterator for this sequence. Iterators will + * then be tracked automatically. + */ + template + class _Safe_sequence : public _Safe_sequence_base + { + public: + /** Invalidates all iterators @c x that reference this sequence, + are not singular, and for which @c __pred(x) returns @c + true. @c __pred will be invoked with the normal iterators nested + in the safe ones. */ + template + void + _M_invalidate_if(_Predicate __pred); + + /** Transfers all iterators @c x that reference @c from sequence, + are not singular, and for which @c __pred(x) returns @c + true. @c __pred will be invoked with the normal iterators nested + in the safe ones. */ + template + void + _M_transfer_from_if(_Safe_sequence& __from, _Predicate __pred); + }; + + /// Like _Safe_sequence but with a special _M_invalidate_all implementation + /// not invalidating past-the-end iterators. Used by node based sequence. + template + class _Safe_node_sequence + : public _Safe_sequence<_Sequence> + { + protected: + void + _M_invalidate_all() + { + typedef typename _Sequence::const_iterator _Const_iterator; + typedef typename _Const_iterator::iterator_type _Base_const_iterator; + typedef __gnu_debug::_Not_equal_to<_Base_const_iterator> _Not_equal; + const _Sequence& __seq = *static_cast<_Sequence*>(this); + this->_M_invalidate_if(_Not_equal(__seq._M_base().end())); + } + }; + +} // namespace __gnu_debug + +#include + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_sequence.tcc b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_sequence.tcc new file mode 100644 index 0000000..353887c --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_sequence.tcc @@ -0,0 +1,156 @@ +// Safe sequence implementation -*- C++ -*- + +// Copyright (C) 2010-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_sequence.tcc + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_SEQUENCE_TCC +#define _GLIBCXX_DEBUG_SAFE_SEQUENCE_TCC 1 + +namespace __gnu_debug +{ + template + template + void + _Safe_sequence<_Sequence>:: + _M_invalidate_if(_Predicate __pred) + { + typedef typename _Sequence::iterator iterator; + typedef typename _Sequence::const_iterator const_iterator; + + __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); + for (_Safe_iterator_base* __iter = _M_iterators; __iter;) + { + iterator* __victim = static_cast(__iter); + __iter = __iter->_M_next; + if (!__victim->_M_singular() && __pred(__victim->base())) + { + __victim->_M_invalidate(); + } + } + + for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;) + { + const_iterator* __victim = static_cast(__iter2); + __iter2 = __iter2->_M_next; + if (!__victim->_M_singular() && __pred(__victim->base())) + { + __victim->_M_invalidate(); + } + } + } + + template + template + void + _Safe_sequence<_Sequence>:: + _M_transfer_from_if(_Safe_sequence& __from, _Predicate __pred) + { + if (this == std::__addressof(__from)) + return; + + typedef typename _Sequence::iterator iterator; + typedef typename _Sequence::const_iterator const_iterator; + + _Safe_iterator_base* __transfered_iterators = 0; + _Safe_iterator_base* __transfered_const_iterators = 0; + _Safe_iterator_base* __last_iterator = 0; + _Safe_iterator_base* __last_const_iterator = 0; + { + // We lock __from first and detach iterator(s) to transfer + __gnu_cxx::__scoped_lock sentry(__from._M_get_mutex()); + + for (_Safe_iterator_base* __iter = __from._M_iterators; __iter;) + { + _Safe_iterator_base* __victim_base = __iter; + iterator* __victim = static_cast(__victim_base); + __iter = __iter->_M_next; + if (!__victim->_M_singular() && __pred(__victim->base())) + { + __victim->_M_detach_single(); + if (__transfered_iterators) + { + __victim_base->_M_next = __transfered_iterators; + __transfered_iterators->_M_prior = __victim_base; + } + else + __last_iterator = __victim_base; + __victim_base->_M_sequence = this; + __victim_base->_M_version = this->_M_version; + __transfered_iterators = __victim_base; + } + } + + for (_Safe_iterator_base* __iter2 = __from._M_const_iterators; + __iter2;) + { + _Safe_iterator_base* __victim_base = __iter2; + const_iterator* __victim = + static_cast(__victim_base); + __iter2 = __iter2->_M_next; + if (!__victim->_M_singular() && __pred(__victim->base())) + { + __victim->_M_detach_single(); + if (__transfered_const_iterators) + { + __victim_base->_M_next = __transfered_const_iterators; + __transfered_const_iterators->_M_prior = __victim_base; + } + else + __last_const_iterator = __victim; + __victim_base->_M_sequence = this; + __victim_base->_M_version = this->_M_version; + __transfered_const_iterators = __victim_base; + } + } + } + + // Now we can lock *this and add the transfered iterators if any + if (__last_iterator || __last_const_iterator) + { + __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); + if (__last_iterator) + { + if (this->_M_iterators) + { + this->_M_iterators->_M_prior = __last_iterator; + __last_iterator->_M_next = this->_M_iterators; + } + this->_M_iterators = __transfered_iterators; + } + if (__last_const_iterator) + { + if (this->_M_const_iterators) + { + this->_M_const_iterators->_M_prior = __last_const_iterator; + __last_const_iterator->_M_next = this->_M_const_iterators; + } + this->_M_const_iterators = __transfered_const_iterators; + } + } + } +} // namespace __gnu_debug + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_base.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_base.h new file mode 100644 index 0000000..93b3418 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_base.h @@ -0,0 +1,185 @@ +// Safe container/iterator base implementation -*- C++ -*- + +// Copyright (C) 2011-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_unordered_base.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_BASE_H +#define _GLIBCXX_DEBUG_SAFE_UNORDERED_BASE_H 1 + +#include + +namespace __gnu_debug +{ + class _Safe_unordered_container_base; + + /** \brief Basic functionality for a @a safe iterator. + * + * The %_Safe_local_iterator_base base class implements the functionality + * of a safe local iterator that is not specific to a particular iterator + * type. It contains a pointer back to the container it references + * along with iterator version information and pointers to form a + * doubly-linked list of local iterators referenced by the container. + * + * This class must not perform any operations that can throw an + * exception, or the exception guarantees of derived iterators will + * be broken. + */ + class _Safe_local_iterator_base : public _Safe_iterator_base + { + protected: + /** Initializes the iterator and makes it singular. */ + _Safe_local_iterator_base() + { } + + /** Initialize the iterator to reference the container pointed to + * by @p __seq. @p __constant is true when we are initializing a + * constant local iterator, and false if it is a mutable local iterator. + * Note that @p __seq may be NULL, in which case the iterator will be + * singular. Otherwise, the iterator will reference @p __seq and + * be nonsingular. + */ + _Safe_local_iterator_base(const _Safe_sequence_base* __seq, bool __constant) + { this->_M_attach(const_cast<_Safe_sequence_base*>(__seq), __constant); } + + /** Initializes the iterator to reference the same container that + @p __x does. @p __constant is true if this is a constant + iterator, and false if it is mutable. */ + _Safe_local_iterator_base(const _Safe_local_iterator_base& __x, + bool __constant) + { this->_M_attach(__x._M_sequence, __constant); } + + ~_Safe_local_iterator_base() { this->_M_detach(); } + + _Safe_unordered_container_base* + _M_get_container() const noexcept; + + /** Attaches this iterator to the given container, detaching it + * from whatever container it was attached to originally. If the + * new container is the NULL pointer, the iterator is left + * unattached. + */ + void + _M_attach(_Safe_sequence_base* __seq, bool __constant); + + /** Likewise, but not thread-safe. */ + void + _M_attach_single(_Safe_sequence_base* __seq, bool __constant) throw (); + + /** Detach the iterator for whatever container it is attached to, + * if any. + */ + void + _M_detach(); + + /** Likewise, but not thread-safe. */ + void + _M_detach_single() throw (); + }; + + /** + * @brief Base class that supports tracking of local iterators that + * reference an unordered container. + * + * The %_Safe_unordered_container_base class provides basic support for + * tracking iterators into an unordered container. Containers that track + * iterators must derived from %_Safe_unordered_container_base publicly, so + * that safe iterators (which inherit _Safe_iterator_base) can + * attach to them. This class contains four linked lists of + * iterators, one for constant iterators, one for mutable + * iterators, one for constant local iterators, one for mutable local + * iterators and a version number that allows very fast + * invalidation of all iterators that reference the container. + * + * This class must ensure that no operation on it may throw an + * exception, otherwise @a safe containers may fail to provide the + * exception-safety guarantees required by the C++ standard. + */ + class _Safe_unordered_container_base : public _Safe_sequence_base + { + friend class _Safe_local_iterator_base; + typedef _Safe_sequence_base _Base; + + public: + /// The list of mutable local iterators that reference this container + _Safe_iterator_base* _M_local_iterators; + + /// The list of constant local iterators that reference this container + _Safe_iterator_base* _M_const_local_iterators; + + protected: + // Initialize with a version number of 1 and no iterators + _Safe_unordered_container_base() noexcept + : _M_local_iterators(nullptr), _M_const_local_iterators(nullptr) + { } + + // Copy constructor does not copy iterators. + _Safe_unordered_container_base(const _Safe_unordered_container_base&) + noexcept + : _Safe_unordered_container_base() { } + + // When moved unordered containers iterators are swapped. + _Safe_unordered_container_base(_Safe_unordered_container_base&& __x) + noexcept + : _Safe_unordered_container_base() + { this->_M_swap(__x); } + + /** Notify all iterators that reference this container that the + container is being destroyed. */ + ~_Safe_unordered_container_base() noexcept + { this->_M_detach_all(); } + + /** Detach all iterators, leaving them singular. */ + void + _M_detach_all(); + + /** Swap this container with the given container. This operation + * also swaps ownership of the iterators, so that when the + * operation is complete all iterators that originally referenced + * one container now reference the other container. + */ + void + _M_swap(_Safe_unordered_container_base& __x) noexcept; + + private: + /** Attach an iterator to this container. */ + void + _M_attach_local(_Safe_iterator_base* __it, bool __constant); + + /** Likewise but not thread safe. */ + void + _M_attach_local_single(_Safe_iterator_base* __it, bool __constant) throw (); + + /** Detach an iterator from this container */ + void + _M_detach_local(_Safe_iterator_base* __it); + + /** Likewise but not thread safe. */ + void + _M_detach_local_single(_Safe_iterator_base* __it) throw (); + }; +} // namespace __gnu_debug + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_container.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_container.h new file mode 100644 index 0000000..aae1e2d --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_container.h @@ -0,0 +1,104 @@ +// Safe container implementation -*- C++ -*- + +// Copyright (C) 2011-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_unordered_container.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_H +#define _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_H 1 + +#include +#include +#include +#include + +namespace __gnu_debug +{ + /** + * @brief Base class for constructing a @a safe unordered container type + * that tracks iterators that reference it. + * + * The class template %_Safe_unordered_container simplifies the + * construction of @a safe unordered containers that track the iterators + * that reference the container, so that the iterators are notified of + * changes in the container that may affect their operation, e.g., if + * the container invalidates its iterators or is destructed. This class + * template may only be used by deriving from it and passing the name + * of the derived class as its template parameter via the curiously + * recurring template pattern. The derived class must have @c + * iterator and @c const_iterator types that are instantiations of + * class template _Safe_iterator for this container and @c local_iterator + * and @c const_local_iterator types that are instantiations of class + * template _Safe_local_iterator for this container. Iterators will + * then be tracked automatically. + */ + template + class _Safe_unordered_container : public _Safe_unordered_container_base + { + private: + _Container& + _M_cont() noexcept + { return *static_cast<_Container*>(this); } + + protected: + void + _M_invalidate_locals() + { + auto __local_end = _M_cont()._M_base().cend(0); + this->_M_invalidate_local_if( + [__local_end](__decltype(__local_end) __it) + { return __it != __local_end; }); + } + + void + _M_invalidate_all() + { + auto __end = _M_cont()._M_base().cend(); + this->_M_invalidate_if([__end](__decltype(__end) __it) + { return __it != __end; }); + _M_invalidate_locals(); + } + + /** Invalidates all iterators @c x that reference this container, + are not singular, and for which @c __pred(x) returns @c + true. @c __pred will be invoked with the normal iterators nested + in the safe ones. */ + template + void + _M_invalidate_if(_Predicate __pred); + + /** Invalidates all local iterators @c x that reference this container, + are not singular, and for which @c __pred(x) returns @c + true. @c __pred will be invoked with the normal local iterators + nested in the safe ones. */ + template + void + _M_invalidate_local_if(_Predicate __pred); + }; +} // namespace __gnu_debug + +#include + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_container.tcc b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_container.tcc new file mode 100644 index 0000000..df2a41d --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/safe_unordered_container.tcc @@ -0,0 +1,100 @@ +// Safe container implementation -*- C++ -*- + +// Copyright (C) 2011-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/safe_unordered_container.tcc + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_TCC +#define _GLIBCXX_DEBUG_SAFE_UNORDERED_CONTAINER_TCC 1 + +namespace __gnu_debug +{ + template + template + void + _Safe_unordered_container<_Container>:: + _M_invalidate_if(_Predicate __pred) + { + typedef typename _Container::iterator iterator; + typedef typename _Container::const_iterator const_iterator; + + __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); + for (_Safe_iterator_base* __iter = _M_iterators; __iter;) + { + iterator* __victim = static_cast(__iter); + __iter = __iter->_M_next; + if (!__victim->_M_singular() && __pred(__victim->base())) + { + __victim->_M_invalidate(); + } + } + + for (_Safe_iterator_base* __iter2 = _M_const_iterators; __iter2;) + { + const_iterator* __victim = static_cast(__iter2); + __iter2 = __iter2->_M_next; + if (!__victim->_M_singular() && __pred(__victim->base())) + { + __victim->_M_invalidate(); + } + } + } + + + template + template + void + _Safe_unordered_container<_Container>:: + _M_invalidate_local_if(_Predicate __pred) + { + typedef typename _Container::local_iterator local_iterator; + typedef typename _Container::const_local_iterator const_local_iterator; + + __gnu_cxx::__scoped_lock sentry(this->_M_get_mutex()); + for (_Safe_iterator_base* __iter = _M_local_iterators; __iter;) + { + local_iterator* __victim = static_cast(__iter); + __iter = __iter->_M_next; + if (!__victim->_M_singular() && __pred(__victim->base())) + { + __victim->_M_invalidate(); + } + } + + for (_Safe_iterator_base* __iter2 = _M_const_local_iterators; __iter2;) + { + const_local_iterator* __victim = + static_cast(__iter2); + __iter2 = __iter2->_M_next; + if (!__victim->_M_singular() && __pred(__victim->base())) + { + __victim->_M_invalidate(); + } + } + } + +} // namespace __gnu_debug + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/set b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/set new file mode 100644 index 0000000..76f3b44 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/set @@ -0,0 +1,44 @@ +// Debugging set/multiset implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/set + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SET +#define _GLIBCXX_DEBUG_SET 1 + +#pragma GCC system_header + +#include +namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { + template class set; + template class multiset; +} } // namespace std::__debug + +#include +#include +#include + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/set.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/set.h new file mode 100644 index 0000000..c579de7 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/set.h @@ -0,0 +1,664 @@ +// Debugging set implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/set.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_SET_H +#define _GLIBCXX_DEBUG_SET_H 1 + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::set with safety/checking/debug instrumentation. + template, + typename _Allocator = std::allocator<_Key> > + class set + : public __gnu_debug::_Safe_container< + set<_Key, _Compare, _Allocator>, _Allocator, + __gnu_debug::_Safe_node_sequence>, + public _GLIBCXX_STD_C::set<_Key,_Compare,_Allocator> + { + typedef _GLIBCXX_STD_C::set<_Key, _Compare, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + set, _Allocator, __gnu_debug::_Safe_node_sequence> _Safe; + + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + + template + friend class ::__gnu_debug::_Safe_iterator; + + // Reference wrapper for base class. Disambiguates set(const _Base&) + // from copy constructor by requiring a user-defined conversion. + // See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + // types: + typedef _Key key_type; + typedef _Key value_type; + typedef _Compare key_compare; + typedef _Compare value_compare; + typedef _Allocator allocator_type; + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator<_Base_iterator, set> + iterator; + typedef __gnu_debug::_Safe_iterator<_Base_const_iterator, set> + const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.3.3.1 construct/copy/destroy: + +#if __cplusplus < 201103L + set() : _Base() { } + + set(const set& __x) + : _Base(__x) { } + + ~set() { } +#else + set() = default; + set(const set&) = default; + set(set&&) = default; + + set(initializer_list __l, + const _Compare& __comp = _Compare(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __comp, __a) { } + + explicit + set(const allocator_type& __a) + : _Base(__a) { } + + set(const set& __x, const allocator_type& __a) + : _Base(__x, __a) { } + + set(set&& __x, const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__x._M_base()), __a)) ) + : _Safe(std::move(__x._M_safe()), __a), + _Base(std::move(__x._M_base()), __a) { } + + set(initializer_list __l, const allocator_type& __a) + : _Base(__l, __a) { } + + template + set(_InputIterator __first, _InputIterator __last, + const allocator_type& __a) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __a) { } + + ~set() = default; +#endif + + explicit set(const _Compare& __comp, + const _Allocator& __a = _Allocator()) + : _Base(__comp, __a) { } + + template + set(_InputIterator __first, _InputIterator __last, + const _Compare& __comp = _Compare(), + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), + __comp, __a) { } + + set(_Base_ref __x) + : _Base(__x._M_ref) { } + +#if __cplusplus < 201103L + set& + operator=(const set& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + return *this; + } +#else + set& + operator=(const set&) = default; + + set& + operator=(set&&) = default; + + set& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } +#endif + + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // capacity: + using _Base::empty; + using _Base::size; + using _Base::max_size; + + // modifiers: +#if __cplusplus >= 201103L + template + std::pair + emplace(_Args&&... __args) + { + auto __res = _Base::emplace(std::forward<_Args>(__args)...); + return { { __res.first, this }, __res.second }; + } + + template + iterator + emplace_hint(const_iterator __pos, _Args&&... __args) + { + __glibcxx_check_insert(__pos); + return + { + _Base::emplace_hint(__pos.base(), std::forward<_Args>(__args)...), + this + }; + } +#endif + + std::pair + insert(const value_type& __x) + { + std::pair<_Base_iterator, bool> __res = _Base::insert(__x); + return std::pair(iterator(__res.first, this), + __res.second); + } + +#if __cplusplus >= 201103L + std::pair + insert(value_type&& __x) + { + auto __res = _Base::insert(std::move(__x)); + return { { __res.first, this }, __res.second }; + } +#endif + + iterator + insert(const_iterator __position, const value_type& __x) + { + __glibcxx_check_insert(__position); + return iterator(_Base::insert(__position.base(), __x), this); + } + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, value_type&& __x) + { + __glibcxx_check_insert(__position); + return { _Base::insert(__position.base(), std::move(__x)), this }; + } +#endif + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + } + +#if __cplusplus >= 201103L + void + insert(initializer_list __l) + { _Base::insert(__l); } +#endif + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + using insert_return_type = _Node_insert_return; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return _Base::extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = find(__key); + if (__position != end()) + return extract(__position); + return {}; + } + + insert_return_type + insert(node_type&& __nh) + { + auto __ret = _Base::insert(std::move(__nh)); + iterator __pos = iterator(__ret.position, this); + return { __pos, __ret.inserted, std::move(__ret.node) }; + } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return { _Base::insert(__hint.base(), std::move(__nh)), this }; + } + + using _Base::merge; +#endif // C++17 + +#if __cplusplus >= 201103L + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(const_iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + return { _Base::erase(__position.base()), this }; + } +#else + void + erase(iterator __position) + { + __glibcxx_check_erase(__position); + this->_M_invalidate_if(_Equal(__position.base())); + _Base::erase(__position.base()); + } +#endif + + size_type + erase(const key_type& __x) + { + _Base_iterator __victim = _Base::find(__x); + if (__victim == _Base::end()) + return 0; + else + { + this->_M_invalidate_if(_Equal(__victim)); + _Base::erase(__victim); + return 1; + } + } + +#if __cplusplus >= 201103L + _GLIBCXX_ABI_TAG_CXX11 + iterator + erase(const_iterator __first, const_iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_const_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::cend(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + + return { _Base::erase(__first.base(), __last.base()), this }; + } +#else + void + erase(iterator __first, iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + for (_Base_iterator __victim = __first.base(); + __victim != __last.base(); ++__victim) + { + _GLIBCXX_DEBUG_VERIFY(__victim != _Base::end(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + this->_M_invalidate_if(_Equal(__victim)); + } + _Base::erase(__first.base(), __last.base()); + } +#endif + + void + swap(set& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + this->_M_invalidate_all(); + _Base::clear(); + } + + // observers: + using _Base::key_comp; + using _Base::value_comp; + + // set operations: + iterator + find(const key_type& __x) + { return iterator(_Base::find(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + find(const key_type& __x) const + { return const_iterator(_Base::find(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + find(const _Kt& __x) + { return { _Base::find(__x), this }; } + + template::type> + const_iterator + find(const _Kt& __x) const + { return { _Base::find(__x), this }; } +#endif + + using _Base::count; + + iterator + lower_bound(const key_type& __x) + { return iterator(_Base::lower_bound(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + lower_bound(const key_type& __x) const + { return const_iterator(_Base::lower_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + lower_bound(const _Kt& __x) + { return { _Base::lower_bound(__x), this }; } + + template::type> + const_iterator + lower_bound(const _Kt& __x) const + { return { _Base::lower_bound(__x), this }; } +#endif + + iterator + upper_bound(const key_type& __x) + { return iterator(_Base::upper_bound(__x), this); } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + const_iterator + upper_bound(const key_type& __x) const + { return const_iterator(_Base::upper_bound(__x), this); } + +#if __cplusplus > 201103L + template::type> + iterator + upper_bound(const _Kt& __x) + { return { _Base::upper_bound(__x), this }; } + + template::type> + const_iterator + upper_bound(const _Kt& __x) const + { return { _Base::upper_bound(__x), this }; } +#endif + + std::pair + equal_range(const key_type& __x) + { + std::pair<_Base_iterator, _Base_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(iterator(__res.first, this), + iterator(__res.second, this)); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 214. set::find() missing const overload + std::pair + equal_range(const key_type& __x) const + { + std::pair<_Base_const_iterator, _Base_const_iterator> __res = + _Base::equal_range(__x); + return std::make_pair(const_iterator(__res.first, this), + const_iterator(__res.second, this)); + } + +#if __cplusplus > 201103L + template::type> + std::pair + equal_range(const _Kt& __x) + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } + + template::type> + std::pair + equal_range(const _Kt& __x) const + { + auto __res = _Base::equal_range(__x); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + }; + +#if __cpp_deduction_guides >= 201606 + + template::value_type>, + typename _Allocator = + allocator::value_type>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireNotAllocator<_Compare>, + typename = _RequireAllocator<_Allocator>> + set(_InputIterator, _InputIterator, + _Compare = _Compare(), _Allocator = _Allocator()) + -> set::value_type, + _Compare, _Allocator>; + + template, + typename _Allocator = allocator<_Key>, + typename = _RequireNotAllocator<_Compare>, + typename = _RequireAllocator<_Allocator>> + set(initializer_list<_Key>, + _Compare = _Compare(), _Allocator = _Allocator()) + -> set<_Key, _Compare, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + set(_InputIterator, _InputIterator, _Allocator) + -> set::value_type, + less::value_type>, + _Allocator>; + + template> + set(initializer_list<_Key>, _Allocator) + -> set<_Key, less<_Key>, _Allocator>; + +#endif // deduction guides + + template + inline bool + operator==(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + +#if __cpp_lib_three_way_comparison + template + inline __detail::__synth3way_t<_Key> + operator<=>(const set<_Key, _Compare, _Alloc>& __lhs, + const set<_Key, _Compare, _Alloc>& __rhs) + { return __lhs._M_base() <=> __rhs._M_base(); } +#else + template + inline bool + operator!=(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const set<_Key, _Compare, _Allocator>& __lhs, + const set<_Key, _Compare, _Allocator>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } +#endif // three-way comparison + + template + void + swap(set<_Key, _Compare, _Allocator>& __x, + set<_Key, _Compare, _Allocator>& __y) + _GLIBCXX_NOEXCEPT_IF(noexcept(__x.swap(__y))) + { return __x.swap(__y); } + +} // namespace __debug +} // namespace std + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/stl_iterator.h b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/stl_iterator.h new file mode 100644 index 0000000..edeb42e --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/stl_iterator.h @@ -0,0 +1,132 @@ +// Debugging support implementation -*- C++ -*- + +// Copyright (C) 2015-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/stl_iterator.h + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_STL_ITERATOR_H +#define _GLIBCXX_DEBUG_STL_ITERATOR_H 1 + +#include + +namespace __gnu_debug +{ + // Help Debug mode to see through reverse_iterator. + template + inline bool + __valid_range(const std::reverse_iterator<_Iterator>& __first, + const std::reverse_iterator<_Iterator>& __last, + typename _Distance_traits<_Iterator>::__type& __dist) + { return __valid_range(__last.base(), __first.base(), __dist); } + + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance(const std::reverse_iterator<_Iterator>& __first, + const std::reverse_iterator<_Iterator>& __last) + { return __get_distance(__last.base(), __first.base()); } + + template + inline bool + __can_advance(const std::reverse_iterator<_Iterator>& __it, _Size __n) + { return __can_advance(__it.base(), -__n); } + + template + inline bool + __can_advance(const std::reverse_iterator<_Iterator>& __it, + const std::pair<_Diff, _Distance_precision>& __dist, + int __way) + { return __can_advance(__it.base(), __dist, -__way); } + + template + inline std::reverse_iterator<_Iterator> + __base(const std::reverse_iterator<_Safe_iterator< + _Iterator, _Sequence, std::random_access_iterator_tag> >& __it) + { return std::reverse_iterator<_Iterator>(__it.base().base()); } + +#if __cplusplus < 201103L + template + struct _Unsafe_type > + { + typedef typename _Unsafe_type<_Iterator>::_Type _UnsafeType; + typedef std::reverse_iterator<_UnsafeType> _Type; + }; + + template + inline std::reverse_iterator::_Type> + __unsafe(const std::reverse_iterator<_Iterator>& __it) + { + typedef typename _Unsafe_type<_Iterator>::_Type _UnsafeType; + return std::reverse_iterator<_UnsafeType>(__unsafe(__it.base())); + } +#else + template + inline auto + __unsafe(const std::reverse_iterator<_Iterator>& __it) + -> decltype(std::__make_reverse_iterator(__unsafe(__it.base()))) + { return std::__make_reverse_iterator(__unsafe(__it.base())); } +#endif + +#if __cplusplus >= 201103L + // Help Debug mode to see through move_iterator. + template + inline bool + __valid_range(const std::move_iterator<_Iterator>& __first, + const std::move_iterator<_Iterator>& __last, + typename _Distance_traits<_Iterator>::__type& __dist) + { return __valid_range(__first.base(), __last.base(), __dist); } + + template + inline typename _Distance_traits<_Iterator>::__type + __get_distance(const std::move_iterator<_Iterator>& __first, + const std::move_iterator<_Iterator>& __last) + { return __get_distance(__first.base(), __last.base()); } + + template + inline bool + __can_advance(const std::move_iterator<_Iterator>& __it, _Size __n) + { return __can_advance(__it.base(), __n); } + + template + inline bool + __can_advance(const std::move_iterator<_Iterator>& __it, + const std::pair<_Diff, _Distance_precision>& __dist, + int __way) + { return __can_advance(__it.base(), __dist, __way); } + + template + inline auto + __unsafe(const std::move_iterator<_Iterator>& __it) + -> decltype(std::make_move_iterator(__unsafe(__it.base()))) + { return std::make_move_iterator(__unsafe(__it.base())); } + + template + inline auto + __base(const std::move_iterator<_Iterator>& __it) + -> decltype(std::make_move_iterator(__base(__it.base()))) + { return std::make_move_iterator(__base(__it.base())); } +#endif +} + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/string b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/string new file mode 100644 index 0000000..8744a55 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/string @@ -0,0 +1,1348 @@ +// Debugging string implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/string + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_STRING +#define _GLIBCXX_DEBUG_STRING 1 + +#pragma GCC system_header + +#include +#include +#include +#include + +#define _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(_Cond,_File,_Line,_Func) \ + if (! (_Cond)) \ + __gnu_debug::_Error_formatter::_S_at(_File, _Line, _Func) \ + ._M_message(#_Cond)._M_error() + +#if _GLIBCXX_USE_CXX11_ABI && __cplusplus >= 201103 +# define _GLIBCXX_INSERT_RETURNS_ITERATOR 1 +# define _GLIBCXX_INSERT_RETURNS_ITERATOR_ONLY(expr) expr +#else +# define _GLIBCXX_INSERT_RETURNS_ITERATOR 0 +# define _GLIBCXX_INSERT_RETURNS_ITERATOR_ONLY(expr) +#endif + +namespace __gnu_debug +{ + /** Checks that __s is non-NULL or __n == 0, and then returns __s. */ + template + inline const _CharT* + __check_string(const _CharT* __s, + _Integer __n __attribute__((__unused__)), + const char* __file __attribute__((__unused__)), + unsigned int __line __attribute__((__unused__)), + const char* __function __attribute__((__unused__))) + { +#ifdef _GLIBCXX_DEBUG_PEDANTIC + _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(__s != 0 || __n == 0, + __file, __line, __function); +#endif + return __s; + } + + /** Checks that __s is non-NULL and then returns __s. */ + template + inline const _CharT* + __check_string(const _CharT* __s, + const char* __file __attribute__((__unused__)), + unsigned int __line __attribute__((__unused__)), + const char* __function __attribute__((__unused__))) + { +#ifdef _GLIBCXX_DEBUG_PEDANTIC + _GLIBCXX_DEBUG_VERIFY_STR_COND_AT(__s != 0, + __file, __line, __function); +#endif + return __s; + } + +#define __glibcxx_check_string_n_constructor(_Str, _Size) \ + __check_string(_Str, _Size, __FILE__, __LINE__, __PRETTY_FUNCTION__) + +#define __glibcxx_check_string_constructor(_Str) \ + __check_string(_Str, __FILE__, __LINE__, __PRETTY_FUNCTION__) + + /// Class std::basic_string with safety/checking/debug instrumentation. + template, + typename _Allocator = std::allocator<_CharT> > + class basic_string + : public __gnu_debug::_Safe_container< + basic_string<_CharT, _Traits, _Allocator>, + _Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)>, + public std::basic_string<_CharT, _Traits, _Allocator> + { + typedef std::basic_string<_CharT, _Traits, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + basic_string, _Allocator, _Safe_sequence, bool(_GLIBCXX_USE_CXX11_ABI)> + _Safe; + + template + friend class ::__gnu_debug::_Safe_iterator; + + // type used for positions in insert, erase etc. + typedef __gnu_debug::_Safe_iterator< + typename _Base::__const_iterator, basic_string> __const_iterator; + + public: + // types: + typedef _Traits traits_type; + typedef typename _Traits::char_type value_type; + typedef _Allocator allocator_type; + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + + typedef __gnu_debug::_Safe_iterator< + typename _Base::iterator, basic_string> iterator; + typedef __gnu_debug::_Safe_iterator< + typename _Base::const_iterator, basic_string> const_iterator; + + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + using _Base::npos; + + // 21.3.1 construct/copy/destroy: + + explicit + basic_string(const _Allocator& __a) _GLIBCXX_NOEXCEPT + : _Base(__a) { } + +#if __cplusplus < 201103L + basic_string() : _Base() { } + + basic_string(const basic_string& __str) + : _Base(__str) { } + + ~basic_string() { } +#else + basic_string() = default; + basic_string(const basic_string&) = default; + basic_string(basic_string&&) = default; + + basic_string(std::initializer_list<_CharT> __l, + const _Allocator& __a = _Allocator()) + : _Base(__l, __a) + { } + + basic_string(const basic_string& __s, const _Allocator& __a) + : _Base(__s, __a) { } + + basic_string(basic_string&& __s, const _Allocator& __a) + noexcept( + std::is_nothrow_constructible<_Base, _Base, const _Allocator&>::value ) + : _Safe(std::move(__s._M_safe()), __a), + _Base(std::move(__s._M_base()), __a) + { } + + ~basic_string() = default; + + // Provides conversion from a normal-mode string to a debug-mode string + basic_string(_Base&& __base) noexcept + : _Base(std::move(__base)) { } +#endif // C++11 + + // Provides conversion from a normal-mode string to a debug-mode string + basic_string(const _Base& __base) + : _Base(__base) { } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 42. string ctors specify wrong default allocator + basic_string(const basic_string& __str, size_type __pos, + size_type __n = _Base::npos, + const _Allocator& __a = _Allocator()) + : _Base(__str, __pos, __n, __a) { } + + basic_string(const _CharT* __s, size_type __n, + const _Allocator& __a = _Allocator()) + : _Base(__glibcxx_check_string_n_constructor(__s, __n), __n, __a) { } + + basic_string(const _CharT* __s, const _Allocator& __a = _Allocator()) + : _Base(__glibcxx_check_string_constructor(__s), __a) + { } + + basic_string(size_type __n, _CharT __c, + const _Allocator& __a = _Allocator()) + : _Base(__n, __c, __a) { } + + template + basic_string(_InputIterator __begin, _InputIterator __end, + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__begin, __end)), + __gnu_debug::__base(__end), __a) { } + +#if __cplusplus < 201103L + basic_string& + operator=(const basic_string& __str) + { + this->_M_safe() = __str; + _M_base() = __str; + return *this; + } +#else + basic_string& + operator=(const basic_string&) = default; + + basic_string& + operator=(basic_string&&) = default; +#endif + + basic_string& + operator=(const _CharT* __s) + { + __glibcxx_check_string(__s); + _M_base() = __s; + this->_M_invalidate_all(); + return *this; + } + + basic_string& + operator=(_CharT __c) + { + _M_base() = __c; + this->_M_invalidate_all(); + return *this; + } + +#if __cplusplus >= 201103L + basic_string& + operator=(std::initializer_list<_CharT> __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } +#endif // C++11 + + // 21.3.2 iterators: + iterator + begin() // _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() // _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() // _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() // _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // 21.3.3 capacity: + using _Base::size; + using _Base::length; + using _Base::max_size; + + void + resize(size_type __n, _CharT __c) + { + _Base::resize(__n, __c); + this->_M_invalidate_all(); + } + + void + resize(size_type __n) + { this->resize(__n, _CharT()); } + +#if __cplusplus >= 201103L + void + shrink_to_fit() noexcept + { + if (capacity() > size()) + { + __try + { + reserve(0); + this->_M_invalidate_all(); + } + __catch(...) + { } + } + } +#endif + + using _Base::capacity; + using _Base::reserve; + + void + clear() // _GLIBCXX_NOEXCEPT + { + _Base::clear(); + this->_M_invalidate_all(); + } + + using _Base::empty; + + // 21.3.4 element access: + const_reference + operator[](size_type __pos) const _GLIBCXX_NOEXCEPT + { + _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(), + _M_message(__gnu_debug::__msg_subscript_oob) + ._M_sequence(*this, "this") + ._M_integer(__pos, "__pos") + ._M_integer(this->size(), "size")); + return _M_base()[__pos]; + } + + reference + operator[](size_type __pos) // _GLIBCXX_NOEXCEPT + { +#if __cplusplus < 201103L && defined(_GLIBCXX_DEBUG_PEDANTIC) + __glibcxx_check_subscript(__pos); +#else + // as an extension v3 allows s[s.size()] when s is non-const. + _GLIBCXX_DEBUG_VERIFY(__pos <= this->size(), + _M_message(__gnu_debug::__msg_subscript_oob) + ._M_sequence(*this, "this") + ._M_integer(__pos, "__pos") + ._M_integer(this->size(), "size")); +#endif + return _M_base()[__pos]; + } + + using _Base::at; + +#if __cplusplus >= 201103L + using _Base::front; + using _Base::back; +#endif + + // 21.3.5 modifiers: + basic_string& + operator+=(const basic_string& __str) + { + _M_base() += __str; + this->_M_invalidate_all(); + return *this; + } + + basic_string& + operator+=(const _CharT* __s) + { + __glibcxx_check_string(__s); + _M_base() += __s; + this->_M_invalidate_all(); + return *this; + } + + basic_string& + operator+=(_CharT __c) + { + _M_base() += __c; + this->_M_invalidate_all(); + return *this; + } + +#if __cplusplus >= 201103L + basic_string& + operator+=(std::initializer_list<_CharT> __l) + { + _M_base() += __l; + this->_M_invalidate_all(); + return *this; + } +#endif // C++11 + + basic_string& + append(const basic_string& __str) + { + _Base::append(__str); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + append(const basic_string& __str, size_type __pos, size_type __n) + { + _Base::append(__str, __pos, __n); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + append(const _CharT* __s, size_type __n) + { + __glibcxx_check_string_len(__s, __n); + _Base::append(__s, __n); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + append(const _CharT* __s) + { + __glibcxx_check_string(__s); + _Base::append(__s); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + append(size_type __n, _CharT __c) + { + _Base::append(__n, __c); + this->_M_invalidate_all(); + return *this; + } + + template + basic_string& + append(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __dp_sign) + _Base::append(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::append(__first, __last); + + this->_M_invalidate_all(); + return *this; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 7. string clause minor problems + void + push_back(_CharT __c) + { + _Base::push_back(__c); + this->_M_invalidate_all(); + } + + basic_string& + assign(const basic_string& __x) + { + _Base::assign(__x); + this->_M_invalidate_all(); + return *this; + } + +#if __cplusplus >= 201103L + basic_string& + assign(basic_string&& __x) + noexcept(noexcept(std::declval<_Base&>().assign(std::move(__x)))) + { + _Base::assign(std::move(__x)); + this->_M_invalidate_all(); + return *this; + } +#endif // C++11 + + basic_string& + assign(const basic_string& __str, size_type __pos, size_type __n) + { + _Base::assign(__str, __pos, __n); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + assign(const _CharT* __s, size_type __n) + { + __glibcxx_check_string_len(__s, __n); + _Base::assign(__s, __n); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + assign(const _CharT* __s) + { + __glibcxx_check_string(__s); + _Base::assign(__s); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + assign(size_type __n, _CharT __c) + { + _Base::assign(__n, __c); + this->_M_invalidate_all(); + return *this; + } + + template + basic_string& + assign(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __dp_sign) + _Base::assign(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::assign(__first, __last); + + this->_M_invalidate_all(); + return *this; + } + +#if __cplusplus >= 201103L + basic_string& + assign(std::initializer_list<_CharT> __l) + { + _Base::assign(__l); + this->_M_invalidate_all(); + return *this; + } +#endif // C++11 + + basic_string& + insert(size_type __pos1, const basic_string& __str) + { + _Base::insert(__pos1, __str); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + insert(size_type __pos1, const basic_string& __str, + size_type __pos2, size_type __n) + { + _Base::insert(__pos1, __str, __pos2, __n); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + insert(size_type __pos, const _CharT* __s, size_type __n) + { + __glibcxx_check_string(__s); + _Base::insert(__pos, __s, __n); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + insert(size_type __pos, const _CharT* __s) + { + __glibcxx_check_string(__s); + _Base::insert(__pos, __s); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + insert(size_type __pos, size_type __n, _CharT __c) + { + _Base::insert(__pos, __n, __c); + this->_M_invalidate_all(); + return *this; + } + + iterator + insert(__const_iterator __p, _CharT __c) + { + __glibcxx_check_insert(__p); + typename _Base::iterator __res = _Base::insert(__p.base(), __c); + this->_M_invalidate_all(); + return iterator(__res, this); + } + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __p, size_type __n, _CharT __c) + { + __glibcxx_check_insert(__p); +#if _GLIBCXX_USE_CXX11_ABI + typename _Base::iterator __res = _Base::insert(__p.base(), __n, __c); +#else + const size_type __offset = __p.base() - _Base::cbegin(); + _Base::insert(_Base::begin() + __offset, __n, __c); + typename _Base::iterator __res = _Base::begin() + __offset; +#endif + this->_M_invalidate_all(); + return iterator(__res, this); + } +#else + void + insert(iterator __p, size_type __n, _CharT __c) + { + __glibcxx_check_insert(__p); + _Base::insert(__p.base(), __n, __c); + this->_M_invalidate_all(); + } +#endif + + template + iterator + insert(__const_iterator __p, + _InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_insert_range(__p, __first, __last, __dist); + + typename _Base::iterator __res; +#if ! _GLIBCXX_INSERT_RETURNS_ITERATOR + const size_type __offset = __p.base() - _Base::begin(); +#endif + if (__dist.second >= __dp_sign) + { + _GLIBCXX_INSERT_RETURNS_ITERATOR_ONLY(__res =) + _Base::insert(__p.base(), __gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + } + else + { + _GLIBCXX_INSERT_RETURNS_ITERATOR_ONLY(__res =) + _Base::insert(__p.base(), __first, __last); + } + +#if ! _GLIBCXX_INSERT_RETURNS_ITERATOR + __res = _Base::begin() + __offset; +#endif + this->_M_invalidate_all(); + return iterator(__res, this); + } + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __p, std::initializer_list<_CharT> __l) + { + __glibcxx_check_insert(__p); +#if _GLIBCXX_USE_CXX11_ABI + const auto __res = _Base::insert(__p.base(), __l); +#else + const size_type __offset = __p.base() - _Base::cbegin(); + _Base::insert(_Base::begin() + __offset, __l); + auto __res = _Base::begin() + __offset; +#endif + this->_M_invalidate_all(); + return iterator(__res, this); + } +#endif // C++11 + + basic_string& + erase(size_type __pos = 0, size_type __n = _Base::npos) + { + _Base::erase(__pos, __n); + this->_M_invalidate_all(); + return *this; + } + + iterator + erase(__const_iterator __position) + { + __glibcxx_check_erase(__position); + typename _Base::iterator __res = _Base::erase(__position.base()); + this->_M_invalidate_all(); + return iterator(__res, this); + } + + iterator + erase(__const_iterator __first, __const_iterator __last) + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + typename _Base::iterator __res = _Base::erase(__first.base(), + __last.base()); + this->_M_invalidate_all(); + return iterator(__res, this); + } + +#if __cplusplus >= 201103L + void + pop_back() // noexcept + { + __glibcxx_check_nonempty(); + _Base::pop_back(); + this->_M_invalidate_all(); + } +#endif // C++11 + + basic_string& + replace(size_type __pos1, size_type __n1, const basic_string& __str) + { + _Base::replace(__pos1, __n1, __str); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + replace(size_type __pos1, size_type __n1, const basic_string& __str, + size_type __pos2, size_type __n2) + { + _Base::replace(__pos1, __n1, __str, __pos2, __n2); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + replace(size_type __pos, size_type __n1, const _CharT* __s, + size_type __n2) + { + __glibcxx_check_string_len(__s, __n2); + _Base::replace(__pos, __n1, __s, __n2); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + replace(size_type __pos, size_type __n1, const _CharT* __s) + { + __glibcxx_check_string(__s); + _Base::replace(__pos, __n1, __s); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + replace(size_type __pos, size_type __n1, size_type __n2, _CharT __c) + { + _Base::replace(__pos, __n1, __n2, __c); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const basic_string& __str) + { + __glibcxx_check_erase_range(__i1, __i2); + _Base::replace(__i1.base(), __i2.base(), __str); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const _CharT* __s, size_type __n) + { + __glibcxx_check_erase_range(__i1, __i2); + __glibcxx_check_string_len(__s, __n); + _Base::replace(__i1.base(), __i2.base(), __s, __n); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + const _CharT* __s) + { + __glibcxx_check_erase_range(__i1, __i2); + __glibcxx_check_string(__s); + _Base::replace(__i1.base(), __i2.base(), __s); + this->_M_invalidate_all(); + return *this; + } + + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + size_type __n, _CharT __c) + { + __glibcxx_check_erase_range(__i1, __i2); + _Base::replace(__i1.base(), __i2.base(), __n, __c); + this->_M_invalidate_all(); + return *this; + } + + template + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + _InputIterator __j1, _InputIterator __j2) + { + __glibcxx_check_erase_range(__i1, __i2); + + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__j1, __j2, __dist); + + if (__dist.second >= __dp_sign) + _Base::replace(__i1.base(), __i2.base(), + __gnu_debug::__unsafe(__j1), + __gnu_debug::__unsafe(__j2)); + else + _Base::replace(__i1.base(), __i2.base(), __j1, __j2); + + this->_M_invalidate_all(); + return *this; + } + +#if __cplusplus >= 201103L + basic_string& + replace(__const_iterator __i1, __const_iterator __i2, + std::initializer_list<_CharT> __l) + { + __glibcxx_check_erase_range(__i1, __i2); + _Base::replace(__i1.base(), __i2.base(), __l); + this->_M_invalidate_all(); + return *this; + } +#endif // C++11 + + size_type + copy(_CharT* __s, size_type __n, size_type __pos = 0) const + { + __glibcxx_check_string_len(__s, __n); + return _Base::copy(__s, __n, __pos); + } + + void + swap(basic_string& __x) + _GLIBCXX_NOEXCEPT_IF(std::__is_nothrow_swappable<_Base>::value) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + // 21.3.6 string operations: + const _CharT* + c_str() const _GLIBCXX_NOEXCEPT + { + const _CharT* __res = _Base::c_str(); + this->_M_invalidate_all(); + return __res; + } + + const _CharT* + data() const _GLIBCXX_NOEXCEPT + { + const _CharT* __res = _Base::data(); + this->_M_invalidate_all(); + return __res; + } + + using _Base::get_allocator; + + size_type + find(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return _Base::find(__str, __pos); } + + size_type + find(const _CharT* __s, size_type __pos, size_type __n) const + { + __glibcxx_check_string(__s); + return _Base::find(__s, __pos, __n); + } + + size_type + find(const _CharT* __s, size_type __pos = 0) const + { + __glibcxx_check_string(__s); + return _Base::find(__s, __pos); + } + + size_type + find(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT + { return _Base::find(__c, __pos); } + + size_type + rfind(const basic_string& __str, size_type __pos = _Base::npos) const + _GLIBCXX_NOEXCEPT + { return _Base::rfind(__str, __pos); } + + size_type + rfind(const _CharT* __s, size_type __pos, size_type __n) const + { + __glibcxx_check_string_len(__s, __n); + return _Base::rfind(__s, __pos, __n); + } + + size_type + rfind(const _CharT* __s, size_type __pos = _Base::npos) const + { + __glibcxx_check_string(__s); + return _Base::rfind(__s, __pos); + } + + size_type + rfind(_CharT __c, size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT + { return _Base::rfind(__c, __pos); } + + size_type + find_first_of(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return _Base::find_first_of(__str, __pos); } + + size_type + find_first_of(const _CharT* __s, size_type __pos, size_type __n) const + { + __glibcxx_check_string(__s); + return _Base::find_first_of(__s, __pos, __n); + } + + size_type + find_first_of(const _CharT* __s, size_type __pos = 0) const + { + __glibcxx_check_string(__s); + return _Base::find_first_of(__s, __pos); + } + + size_type + find_first_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT + { return _Base::find_first_of(__c, __pos); } + + size_type + find_last_of(const basic_string& __str, + size_type __pos = _Base::npos) const _GLIBCXX_NOEXCEPT + { return _Base::find_last_of(__str, __pos); } + + size_type + find_last_of(const _CharT* __s, size_type __pos, size_type __n) const + { + __glibcxx_check_string(__s); + return _Base::find_last_of(__s, __pos, __n); + } + + size_type + find_last_of(const _CharT* __s, size_type __pos = _Base::npos) const + { + __glibcxx_check_string(__s); + return _Base::find_last_of(__s, __pos); + } + + size_type + find_last_of(_CharT __c, size_type __pos = _Base::npos) const + _GLIBCXX_NOEXCEPT + { return _Base::find_last_of(__c, __pos); } + + size_type + find_first_not_of(const basic_string& __str, size_type __pos = 0) const + _GLIBCXX_NOEXCEPT + { return _Base::find_first_not_of(__str, __pos); } + + size_type + find_first_not_of(const _CharT* __s, size_type __pos, size_type __n) const + { + __glibcxx_check_string_len(__s, __n); + return _Base::find_first_not_of(__s, __pos, __n); + } + + size_type + find_first_not_of(const _CharT* __s, size_type __pos = 0) const + { + __glibcxx_check_string(__s); + return _Base::find_first_not_of(__s, __pos); + } + + size_type + find_first_not_of(_CharT __c, size_type __pos = 0) const _GLIBCXX_NOEXCEPT + { return _Base::find_first_not_of(__c, __pos); } + + size_type + find_last_not_of(const basic_string& __str, + size_type __pos = _Base::npos) const + _GLIBCXX_NOEXCEPT + { return _Base::find_last_not_of(__str, __pos); } + + size_type + find_last_not_of(const _CharT* __s, size_type __pos, size_type __n) const + { + __glibcxx_check_string(__s); + return _Base::find_last_not_of(__s, __pos, __n); + } + + size_type + find_last_not_of(const _CharT* __s, size_type __pos = _Base::npos) const + { + __glibcxx_check_string(__s); + return _Base::find_last_not_of(__s, __pos); + } + + size_type + find_last_not_of(_CharT __c, size_type __pos = _Base::npos) const + _GLIBCXX_NOEXCEPT + { return _Base::find_last_not_of(__c, __pos); } + + basic_string + substr(size_type __pos = 0, size_type __n = _Base::npos) const + { return basic_string(_Base::substr(__pos, __n)); } + + int + compare(const basic_string& __str) const + { return _Base::compare(__str); } + + int + compare(size_type __pos1, size_type __n1, + const basic_string& __str) const + { return _Base::compare(__pos1, __n1, __str); } + + int + compare(size_type __pos1, size_type __n1, const basic_string& __str, + size_type __pos2, size_type __n2) const + { return _Base::compare(__pos1, __n1, __str, __pos2, __n2); } + + int + compare(const _CharT* __s) const + { + __glibcxx_check_string(__s); + return _Base::compare(__s); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 5. string::compare specification questionable + int + compare(size_type __pos1, size_type __n1, const _CharT* __s) const + { + __glibcxx_check_string(__s); + return _Base::compare(__pos1, __n1, __s); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 5. string::compare specification questionable + int + compare(size_type __pos1, size_type __n1,const _CharT* __s, + size_type __n2) const + { + __glibcxx_check_string_len(__s, __n2); + return _Base::compare(__pos1, __n1, __s, __n2); + } + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + + using _Safe::_M_invalidate_all; + }; + + template + inline basic_string<_CharT,_Traits,_Allocator> + operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } + + template + inline basic_string<_CharT,_Traits,_Allocator> + operator+(const _CharT* __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { + __glibcxx_check_string(__lhs); + return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; + } + + template + inline basic_string<_CharT,_Traits,_Allocator> + operator+(_CharT __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { return basic_string<_CharT,_Traits,_Allocator>(1, __lhs) += __rhs; } + + template + inline basic_string<_CharT,_Traits,_Allocator> + operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const _CharT* __rhs) + { + __glibcxx_check_string(__rhs); + return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; + } + + template + inline basic_string<_CharT,_Traits,_Allocator> + operator+(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + _CharT __rhs) + { return basic_string<_CharT,_Traits,_Allocator>(__lhs) += __rhs; } + + template + inline bool + operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + + template + inline bool + operator==(const _CharT* __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { + __glibcxx_check_string(__lhs); + return __lhs == __rhs._M_base(); + } + + template + inline bool + operator==(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const _CharT* __rhs) + { + __glibcxx_check_string(__rhs); + return __lhs._M_base() == __rhs; + } + + template + inline bool + operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator!=(const _CharT* __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { + __glibcxx_check_string(__lhs); + return __lhs != __rhs._M_base(); + } + + template + inline bool + operator!=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const _CharT* __rhs) + { + __glibcxx_check_string(__rhs); + return __lhs._M_base() != __rhs; + } + + template + inline bool + operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<(const _CharT* __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { + __glibcxx_check_string(__lhs); + return __lhs < __rhs._M_base(); + } + + template + inline bool + operator<(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const _CharT* __rhs) + { + __glibcxx_check_string(__rhs); + return __lhs._M_base() < __rhs; + } + + template + inline bool + operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator<=(const _CharT* __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { + __glibcxx_check_string(__lhs); + return __lhs <= __rhs._M_base(); + } + + template + inline bool + operator<=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const _CharT* __rhs) + { + __glibcxx_check_string(__rhs); + return __lhs._M_base() <= __rhs; + } + + template + inline bool + operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>=(const _CharT* __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { + __glibcxx_check_string(__lhs); + return __lhs >= __rhs._M_base(); + } + + template + inline bool + operator>=(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const _CharT* __rhs) + { + __glibcxx_check_string(__rhs); + return __lhs._M_base() >= __rhs; + } + + template + inline bool + operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } + + template + inline bool + operator>(const _CharT* __lhs, + const basic_string<_CharT,_Traits,_Allocator>& __rhs) + { + __glibcxx_check_string(__lhs); + return __lhs > __rhs._M_base(); + } + + template + inline bool + operator>(const basic_string<_CharT,_Traits,_Allocator>& __lhs, + const _CharT* __rhs) + { + __glibcxx_check_string(__rhs); + return __lhs._M_base() > __rhs; + } + + // 21.3.7.8: + template + inline void + swap(basic_string<_CharT,_Traits,_Allocator>& __lhs, + basic_string<_CharT,_Traits,_Allocator>& __rhs) + { __lhs.swap(__rhs); } + + template + std::basic_ostream<_CharT, _Traits>& + operator<<(std::basic_ostream<_CharT, _Traits>& __os, + const basic_string<_CharT, _Traits, _Allocator>& __str) + { return __os << __str._M_base(); } + + template + std::basic_istream<_CharT,_Traits>& + operator>>(std::basic_istream<_CharT,_Traits>& __is, + basic_string<_CharT,_Traits,_Allocator>& __str) + { + std::basic_istream<_CharT,_Traits>& __res = __is >> __str._M_base(); + __str._M_invalidate_all(); + return __res; + } + + template + std::basic_istream<_CharT,_Traits>& + getline(std::basic_istream<_CharT,_Traits>& __is, + basic_string<_CharT,_Traits,_Allocator>& __str, _CharT __delim) + { + std::basic_istream<_CharT,_Traits>& __res = getline(__is, + __str._M_base(), + __delim); + __str._M_invalidate_all(); + return __res; + } + + template + std::basic_istream<_CharT,_Traits>& + getline(std::basic_istream<_CharT,_Traits>& __is, + basic_string<_CharT,_Traits,_Allocator>& __str) + { + std::basic_istream<_CharT,_Traits>& __res = getline(__is, + __str._M_base()); + __str._M_invalidate_all(); + return __res; + } + + typedef basic_string string; + +#ifdef _GLIBCXX_USE_WCHAR_T + typedef basic_string wstring; +#endif + +#ifdef _GLIBCXX_USE_CHAR8_T + /// A string of @c char8_t + typedef basic_string u8string; +#endif + +#if __cplusplus >= 201103L + /// A string of @c char16_t + typedef basic_string u16string; + + /// A string of @c char32_t + typedef basic_string u32string; +#endif + + template + struct _Insert_range_from_self_is_safe< + __gnu_debug::basic_string<_CharT, _Traits, _Allocator> > + { enum { __value = 1 }; }; + +} // namespace __gnu_debug + +#if __cplusplus >= 201103L +namespace std _GLIBCXX_VISIBILITY(default) +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + /// std::hash specialization for __gnu_debug::basic_string. + template + struct hash<__gnu_debug::basic_string<_CharT>> + : public hash> + { }; + + template + struct __is_fast_hash>> + : __is_fast_hash>> + { }; + +_GLIBCXX_END_NAMESPACE_VERSION +} +#endif /* C++11 */ + +#undef _GLIBCXX_INSERT_RETURNS_ITERATOR +#undef _GLIBCXX_INSERT_RETURNS_ITERATOR_ONLY + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/unordered_map b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/unordered_map new file mode 100644 index 0000000..bb697d3 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/unordered_map @@ -0,0 +1,1467 @@ +// Debugging unordered_map/unordered_multimap implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/unordered_map + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_UNORDERED_MAP +#define _GLIBCXX_DEBUG_UNORDERED_MAP 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include +#else +# include +namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { + template + class unordered_map; + template + class unordered_multimap; +} } // namespace std::__debug + +# include + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::unordered_map with safety/checking/debug instrumentation. + template, + typename _Pred = std::equal_to<_Key>, + typename _Alloc = std::allocator > > + class unordered_map + : public __gnu_debug::_Safe_container< + unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>, _Alloc, + __gnu_debug::_Safe_unordered_container>, + public _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc> + { + typedef _GLIBCXX_STD_C::unordered_map<_Key, _Tp, _Hash, + _Pred, _Alloc> _Base; + typedef __gnu_debug::_Safe_container _Safe; + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef typename _Base::const_local_iterator + _Base_const_local_iterator; + typedef typename _Base::local_iterator _Base_local_iterator; + + template + friend class ::__gnu_debug::_Safe_iterator; + template + friend class ::__gnu_debug::_Safe_local_iterator; + + // Reference wrapper for base class. See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + typedef typename _Base::size_type size_type; + typedef typename _Base::hasher hasher; + typedef typename _Base::key_equal key_equal; + typedef typename _Base::allocator_type allocator_type; + + typedef typename _Base::key_type key_type; + typedef typename _Base::value_type value_type; + + typedef __gnu_debug::_Safe_iterator< + _Base_iterator, unordered_map> iterator; + typedef __gnu_debug::_Safe_iterator< + _Base_const_iterator, unordered_map> const_iterator; + typedef __gnu_debug::_Safe_local_iterator< + _Base_local_iterator, unordered_map> local_iterator; + typedef __gnu_debug::_Safe_local_iterator< + _Base_const_local_iterator, unordered_map> const_local_iterator; + + unordered_map() = default; + + explicit + unordered_map(size_type __n, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__n, __hf, __eql, __a) { } + + template + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __n, + __hf, __eql, __a) { } + + unordered_map(const unordered_map&) = default; + + unordered_map(_Base_ref __x) + : _Base(__x._M_ref) { } + + unordered_map(unordered_map&&) = default; + + explicit + unordered_map(const allocator_type& __a) + : _Base(__a) { } + + unordered_map(const unordered_map& __umap, + const allocator_type& __a) + : _Base(__umap, __a) { } + + unordered_map(unordered_map&& __umap, + const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__umap._M_base()), __a)) ) + : _Safe(std::move(__umap._M_safe()), __a), + _Base(std::move(__umap._M_base()), __a) { } + + unordered_map(initializer_list __l, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __n, __hf, __eql, __a) { } + + unordered_map(size_type __n, const allocator_type& __a) + : unordered_map(__n, hasher(), key_equal(), __a) + { } + + unordered_map(size_type __n, + const hasher& __hf, + const allocator_type& __a) + : unordered_map(__n, __hf, key_equal(), __a) + { } + + template + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template + unordered_map(_InputIterator __first, _InputIterator __last, + size_type __n, + const hasher& __hf, + const allocator_type& __a) + : unordered_map(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_map(initializer_list __l, + size_type __n, + const allocator_type& __a) + : unordered_map(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_map(initializer_list __l, + size_type __n, + const hasher& __hf, + const allocator_type& __a) + : unordered_map(__l, __n, __hf, key_equal(), __a) + { } + + ~unordered_map() = default; + + unordered_map& + operator=(const unordered_map&) = default; + + unordered_map& + operator=(unordered_map&&) = default; + + unordered_map& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } + + void + swap(unordered_map& __x) + noexcept( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() noexcept + { + _Base::clear(); + this->_M_invalidate_all(); + } + + iterator + begin() noexcept + { return { _Base::begin(), this }; } + + const_iterator + begin() const noexcept + { return { _Base::begin(), this }; } + + iterator + end() noexcept + { return { _Base::end(), this }; } + + const_iterator + end() const noexcept + { return { _Base::end(), this }; } + + const_iterator + cbegin() const noexcept + { return { _Base::cbegin(), this }; } + + const_iterator + cend() const noexcept + { return { _Base::cend(), this }; } + + // local versions + local_iterator + begin(size_type __b) + { + __glibcxx_check_bucket_index(__b); + return { _Base::begin(__b), this }; + } + + local_iterator + end(size_type __b) + { + __glibcxx_check_bucket_index(__b); + return { _Base::end(__b), this }; + } + + const_local_iterator + begin(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::begin(__b), this }; + } + + const_local_iterator + end(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::end(__b), this }; + } + + const_local_iterator + cbegin(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::cbegin(__b), this }; + } + + const_local_iterator + cend(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::cend(__b), this }; + } + + size_type + bucket_size(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return _Base::bucket_size(__b); + } + + float + max_load_factor() const noexcept + { return _Base::max_load_factor(); } + + void + max_load_factor(float __f) + { + __glibcxx_check_max_load_factor(__f); + _Base::max_load_factor(__f); + } + + template + std::pair + emplace(_Args&&... __args) + { + size_type __bucket_count = this->bucket_count(); + auto __res = _Base::emplace(std::forward<_Args>(__args)...); + _M_check_rehashed(__bucket_count); + return { { __res.first, this }, __res.second }; + } + + template + iterator + emplace_hint(const_iterator __hint, _Args&&... __args) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::emplace_hint(__hint.base(), + std::forward<_Args>(__args)...); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + std::pair + insert(const value_type& __obj) + { + size_type __bucket_count = this->bucket_count(); + auto __res = _Base::insert(__obj); + _M_check_rehashed(__bucket_count); + return { { __res.first, this }, __res.second }; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + std::pair + insert(value_type&& __x) + { + size_type __bucket_count = this->bucket_count(); + auto __res = _Base::insert(std::move(__x)); + _M_check_rehashed(__bucket_count); + return { { __res.first, this }, __res.second }; + } + + template::value>::type> + std::pair + insert(_Pair&& __obj) + { + size_type __bucket_count = this->bucket_count(); + auto __res = _Base::insert(std::forward<_Pair>(__obj)); + _M_check_rehashed(__bucket_count); + return { { __res.first, this }, __res.second }; + } + + iterator + insert(const_iterator __hint, const value_type& __obj) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__hint.base(), __obj); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __hint, value_type&& __x) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__hint.base(), std::move(__x)); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + template::value>::type> + iterator + insert(const_iterator __hint, _Pair&& __obj) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__hint.base(), std::forward<_Pair>(__obj)); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + void + insert(std::initializer_list __l) + { + size_type __bucket_count = this->bucket_count(); + _Base::insert(__l); + _M_check_rehashed(__bucket_count); + } + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + size_type __bucket_count = this->bucket_count(); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + + _M_check_rehashed(__bucket_count); + } + +#if __cplusplus > 201402L + template + pair + try_emplace(const key_type& __k, _Args&&... __args) + { + auto __res = _Base::try_emplace(__k, + std::forward<_Args>(__args)...); + return { { __res.first, this }, __res.second }; + } + + template + pair + try_emplace(key_type&& __k, _Args&&... __args) + { + auto __res = _Base::try_emplace(std::move(__k), + std::forward<_Args>(__args)...); + return { { __res.first, this }, __res.second }; + } + + template + iterator + try_emplace(const_iterator __hint, const key_type& __k, + _Args&&... __args) + { + __glibcxx_check_insert(__hint); + return { _Base::try_emplace(__hint.base(), __k, + std::forward<_Args>(__args)...), + this }; + } + + template + iterator + try_emplace(const_iterator __hint, key_type&& __k, _Args&&... __args) + { + __glibcxx_check_insert(__hint); + return { _Base::try_emplace(__hint.base(), std::move(__k), + std::forward<_Args>(__args)...), + this }; + } + + template + pair + insert_or_assign(const key_type& __k, _Obj&& __obj) + { + auto __res = _Base::insert_or_assign(__k, + std::forward<_Obj>(__obj)); + return { { __res.first, this }, __res.second }; + } + + template + pair + insert_or_assign(key_type&& __k, _Obj&& __obj) + { + auto __res = _Base::insert_or_assign(std::move(__k), + std::forward<_Obj>(__obj)); + return { { __res.first, this }, __res.second }; + } + + template + iterator + insert_or_assign(const_iterator __hint, const key_type& __k, + _Obj&& __obj) + { + __glibcxx_check_insert(__hint); + return { _Base::insert_or_assign(__hint.base(), __k, + std::forward<_Obj>(__obj)), + this }; + } + + template + iterator + insert_or_assign(const_iterator __hint, key_type&& __k, _Obj&& __obj) + { + __glibcxx_check_insert(__hint); + return { _Base::insert_or_assign(__hint.base(), std::move(__k), + std::forward<_Obj>(__obj)), + this }; + } +#endif // C++17 + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + using insert_return_type = _Node_insert_return; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + return _M_extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = _Base::find(__key); + if (__position != _Base::end()) + return _M_extract(__position); + return {}; + } + + insert_return_type + insert(node_type&& __nh) + { + auto __ret = _Base::insert(std::move(__nh)); + return + { { __ret.position, this }, __ret.inserted, std::move(__ret.node) }; + } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return { _Base::insert(__hint.base(), std::move(__nh)), this }; + } + + using _Base::merge; +#endif // C++17 + + iterator + find(const key_type& __key) + { return { _Base::find(__key), this }; } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + iterator + find(const _Kt& __k) + { return { _Base::find(__k), this }; } +#endif + + const_iterator + find(const key_type& __key) const + { return { _Base::find(__key), this }; } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + const_iterator + find(const _Kt& __k) const + { return { _Base::find(__k), this }; } +#endif + + std::pair + equal_range(const key_type& __key) + { + auto __res = _Base::equal_range(__key); + return { { __res.first, this }, { __res.second, this } }; + } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + std::pair + equal_range(const _Kt& __k) + { + auto __res = _Base::equal_range(__k); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + std::pair + equal_range(const key_type& __key) const + { + auto __res = _Base::equal_range(__key); + return { { __res.first, this }, { __res.second, this } }; + } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + std::pair + equal_range(const _Kt& __k) const + { + auto __res = _Base::equal_range(__k); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + size_type + erase(const key_type& __key) + { + size_type __ret(0); + auto __victim = _Base::find(__key); + if (__victim != _Base::end()) + { + _M_erase(__victim); + __ret = 1; + } + return __ret; + } + + iterator + erase(const_iterator __it) + { + __glibcxx_check_erase(__it); + return { _M_erase(__it.base()), this }; + } + + iterator + erase(iterator __it) + { + __glibcxx_check_erase(__it); + return { _M_erase(__it.base()), this }; + } + + iterator + erase(const_iterator __first, const_iterator __last) + { + __glibcxx_check_erase_range(__first, __last); + for (auto __tmp = __first.base(); __tmp != __last.base(); ++__tmp) + { + _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::cend(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + _M_invalidate(__tmp); + } + + size_type __bucket_count = this->bucket_count(); + auto __next = _Base::erase(__first.base(), __last.base()); + _M_check_rehashed(__bucket_count); + return { __next, this }; + } + + _Base& + _M_base() noexcept { return *this; } + + const _Base& + _M_base() const noexcept { return *this; } + + private: + void + _M_check_rehashed(size_type __prev_count) + { + if (__prev_count != this->bucket_count()) + this->_M_invalidate_all(); + } + + void + _M_invalidate(_Base_const_iterator __victim) + { + this->_M_invalidate_if( + [__victim](_Base_const_iterator __it) { return __it == __victim; }); + this->_M_invalidate_local_if( + [__victim](_Base_const_local_iterator __it) + { return __it == __victim; }); + } + + _Base_iterator + _M_erase(_Base_const_iterator __victim) + { + _M_invalidate(__victim); + size_type __bucket_count = this->bucket_count(); + _Base_iterator __next = _Base::erase(__victim); + _M_check_rehashed(__bucket_count); + return __next; + } + +#if __cplusplus > 201402L + node_type + _M_extract(_Base_const_iterator __victim) + { + _M_invalidate(__victim); + return _Base::extract(__victim); + } +#endif + }; + +#if __cpp_deduction_guides >= 201606 + + template>, + typename _Pred = equal_to<__iter_key_t<_InputIterator>>, + typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireNotAllocator<_Pred>, + typename = _RequireAllocator<_Allocator>> + unordered_map(_InputIterator, _InputIterator, + typename unordered_map::size_type = {}, + _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) + -> unordered_map<__iter_key_t<_InputIterator>, + __iter_val_t<_InputIterator>, + _Hash, _Pred, _Allocator>; + + template, + typename _Pred = equal_to<_Key>, + typename _Allocator = allocator>, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireNotAllocator<_Pred>, + typename = _RequireAllocator<_Allocator>> + unordered_map(initializer_list>, + typename unordered_map::size_type = {}, + _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) + -> unordered_map<_Key, _Tp, _Hash, _Pred, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + unordered_map(_InputIterator, _InputIterator, + typename unordered_map::size_type, _Allocator) + -> unordered_map<__iter_key_t<_InputIterator>, + __iter_val_t<_InputIterator>, + hash<__iter_key_t<_InputIterator>>, + equal_to<__iter_key_t<_InputIterator>>, + _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + unordered_map(_InputIterator, _InputIterator, _Allocator) + -> unordered_map<__iter_key_t<_InputIterator>, + __iter_val_t<_InputIterator>, + hash<__iter_key_t<_InputIterator>>, + equal_to<__iter_key_t<_InputIterator>>, + _Allocator>; + + template, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireAllocator<_Allocator>> + unordered_map(_InputIterator, _InputIterator, + typename unordered_map::size_type, + _Hash, _Allocator) + -> unordered_map<__iter_key_t<_InputIterator>, + __iter_val_t<_InputIterator>, _Hash, + equal_to<__iter_key_t<_InputIterator>>, _Allocator>; + + template> + unordered_map(initializer_list>, + typename unordered_map::size_type, + _Allocator) + -> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>; + + template> + unordered_map(initializer_list>, _Allocator) + -> unordered_map<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + unordered_map(initializer_list>, + typename unordered_map::size_type, + _Hash, _Allocator) + -> unordered_map<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>; + +#endif + + template + inline void + swap(unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + inline bool + operator==(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { return __x._M_base() == __y._M_base(); } + +#if __cpp_impl_three_way_comparison < 201907L + template + inline bool + operator!=(const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + const unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { return !(__x == __y); } +#endif + + /// Class std::unordered_multimap with safety/checking/debug instrumentation. + template, + typename _Pred = std::equal_to<_Key>, + typename _Alloc = std::allocator > > + class unordered_multimap + : public __gnu_debug::_Safe_container< + unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>, _Alloc, + __gnu_debug::_Safe_unordered_container>, + public _GLIBCXX_STD_C::unordered_multimap< + _Key, _Tp, _Hash, _Pred, _Alloc> + { + typedef _GLIBCXX_STD_C::unordered_multimap<_Key, _Tp, _Hash, + _Pred, _Alloc> _Base; + typedef __gnu_debug::_Safe_container _Safe; + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef typename _Base::const_local_iterator _Base_const_local_iterator; + typedef typename _Base::local_iterator _Base_local_iterator; + + template + friend class ::__gnu_debug::_Safe_iterator; + template + friend class ::__gnu_debug::_Safe_local_iterator; + + // Reference wrapper for base class. See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + typedef typename _Base::size_type size_type; + typedef typename _Base::hasher hasher; + typedef typename _Base::key_equal key_equal; + typedef typename _Base::allocator_type allocator_type; + + typedef typename _Base::key_type key_type; + typedef typename _Base::value_type value_type; + + typedef __gnu_debug::_Safe_iterator< + _Base_iterator, unordered_multimap> iterator; + typedef __gnu_debug::_Safe_iterator< + _Base_const_iterator, unordered_multimap> const_iterator; + typedef __gnu_debug::_Safe_local_iterator< + _Base_local_iterator, unordered_multimap> local_iterator; + typedef __gnu_debug::_Safe_local_iterator< + _Base_const_local_iterator, unordered_multimap> const_local_iterator; + + unordered_multimap() = default; + + explicit + unordered_multimap(size_type __n, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__n, __hf, __eql, __a) { } + + template + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __n, + __hf, __eql, __a) { } + + unordered_multimap(const unordered_multimap&) = default; + + unordered_multimap(_Base_ref __x) + : _Base(__x._M_ref) { } + + unordered_multimap(unordered_multimap&&) = default; + + explicit + unordered_multimap(const allocator_type& __a) + : _Base(__a) { } + + unordered_multimap(const unordered_multimap& __umap, + const allocator_type& __a) + : _Base(__umap, __a) { } + + unordered_multimap(unordered_multimap&& __umap, + const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__umap._M_base()), __a)) ) + : _Safe(std::move(__umap._M_safe()), __a), + _Base(std::move(__umap._M_base()), __a) { } + + unordered_multimap(initializer_list __l, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __n, __hf, __eql, __a) { } + + unordered_multimap(size_type __n, const allocator_type& __a) + : unordered_multimap(__n, hasher(), key_equal(), __a) + { } + + unordered_multimap(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__n, __hf, key_equal(), __a) + { } + + template + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template + unordered_multimap(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_multimap(initializer_list __l, + size_type __n, + const allocator_type& __a) + : unordered_multimap(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_multimap(initializer_list __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multimap(__l, __n, __hf, key_equal(), __a) + { } + + ~unordered_multimap() = default; + + unordered_multimap& + operator=(const unordered_multimap&) = default; + + unordered_multimap& + operator=(unordered_multimap&&) = default; + + unordered_multimap& + operator=(initializer_list __l) + { + this->_M_base() = __l; + this->_M_invalidate_all(); + return *this; + } + + void + swap(unordered_multimap& __x) + noexcept( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() noexcept + { + _Base::clear(); + this->_M_invalidate_all(); + } + + iterator + begin() noexcept + { return { _Base::begin(), this }; } + + const_iterator + begin() const noexcept + { return { _Base::begin(), this }; } + + iterator + end() noexcept + { return { _Base::end(), this }; } + + const_iterator + end() const noexcept + { return { _Base::end(), this }; } + + const_iterator + cbegin() const noexcept + { return { _Base::cbegin(), this }; } + + const_iterator + cend() const noexcept + { return { _Base::cend(), this }; } + + // local versions + local_iterator + begin(size_type __b) + { + __glibcxx_check_bucket_index(__b); + return { _Base::begin(__b), this }; + } + + local_iterator + end(size_type __b) + { + __glibcxx_check_bucket_index(__b); + return { _Base::end(__b), this }; + } + + const_local_iterator + begin(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::begin(__b), this }; + } + + const_local_iterator + end(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::end(__b), this }; + } + + const_local_iterator + cbegin(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::cbegin(__b), this }; + } + + const_local_iterator + cend(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::cend(__b), this }; + } + + size_type + bucket_size(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return _Base::bucket_size(__b); + } + + float + max_load_factor() const noexcept + { return _Base::max_load_factor(); } + + void + max_load_factor(float __f) + { + __glibcxx_check_max_load_factor(__f); + _Base::max_load_factor(__f); + } + + template + iterator + emplace(_Args&&... __args) + { + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::emplace(std::forward<_Args>(__args)...); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + template + iterator + emplace_hint(const_iterator __hint, _Args&&... __args) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::emplace_hint(__hint.base(), + std::forward<_Args>(__args)...); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + iterator + insert(const value_type& __obj) + { + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__obj); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(value_type&& __x) + { + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(std::move(__x)); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + iterator + insert(const_iterator __hint, const value_type& __obj) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__hint.base(), __obj); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 2354. Unnecessary copying when inserting into maps with braced-init + iterator + insert(const_iterator __hint, value_type&& __x) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__hint.base(), std::move(__x)); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + template::value>::type> + iterator + insert(_Pair&& __obj) + { + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(std::forward<_Pair>(__obj)); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + template::value>::type> + iterator + insert(const_iterator __hint, _Pair&& __obj) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__hint.base(), std::forward<_Pair>(__obj)); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + void + insert(std::initializer_list __l) + { _Base::insert(__l); } + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + size_type __bucket_count = this->bucket_count(); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + + _M_check_rehashed(__bucket_count); + } + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + return _M_extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = _Base::find(__key); + if (__position != _Base::end()) + return _M_extract(__position); + return {}; + } + + iterator + insert(node_type&& __nh) + { return { _Base::insert(std::move(__nh)), this }; } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return { _Base::insert(__hint.base(), std::move(__nh)), this }; + } + + using _Base::merge; +#endif // C++17 + + iterator + find(const key_type& __key) + { return { _Base::find(__key), this }; } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + iterator + find(const _Kt& __k) + { return { _Base::find(__k), this }; } +#endif + + const_iterator + find(const key_type& __key) const + { return { _Base::find(__key), this }; } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + const_iterator + find(const _Kt& __k) const + { return { _Base::find(__k), this }; } +#endif + + std::pair + equal_range(const key_type& __key) + { + auto __res = _Base::equal_range(__key); + return { { __res.first, this }, { __res.second, this } }; + } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + std::pair + equal_range(const _Kt& __k) + { + auto __res = _Base::equal_range(__k); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + std::pair + equal_range(const key_type& __key) const + { + auto __res = _Base::equal_range(__key); + return { { __res.first, this }, { __res.second, this } }; + } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + std::pair + equal_range(const _Kt& __k) const + { + auto __res = _Base::equal_range(__k); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + size_type + erase(const key_type& __key) + { + size_type __ret(0); + size_type __bucket_count = this->bucket_count(); + auto __pair = _Base::equal_range(__key); + for (auto __victim = __pair.first; __victim != __pair.second;) + { + _M_invalidate(__victim); + __victim = _Base::erase(__victim); + ++__ret; + } + + _M_check_rehashed(__bucket_count); + return __ret; + } + + iterator + erase(const_iterator __it) + { + __glibcxx_check_erase(__it); + return { _M_erase(__it.base()), this }; + } + + iterator + erase(iterator __it) + { + __glibcxx_check_erase(__it); + return { _M_erase(__it.base()), this }; + } + + iterator + erase(const_iterator __first, const_iterator __last) + { + __glibcxx_check_erase_range(__first, __last); + for (auto __tmp = __first.base(); __tmp != __last.base(); ++__tmp) + { + _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::cend(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + _M_invalidate(__tmp); + } + + size_type __bucket_count = this->bucket_count(); + auto __next = _Base::erase(__first.base(), __last.base()); + _M_check_rehashed(__bucket_count); + return { __next, this }; + } + + _Base& + _M_base() noexcept { return *this; } + + const _Base& + _M_base() const noexcept { return *this; } + + private: + void + _M_check_rehashed(size_type __prev_count) + { + if (__prev_count != this->bucket_count()) + this->_M_invalidate_all(); + } + + void + _M_invalidate(_Base_const_iterator __victim) + { + this->_M_invalidate_if( + [__victim](_Base_const_iterator __it) { return __it == __victim; }); + this->_M_invalidate_local_if( + [__victim](_Base_const_local_iterator __it) + { return __it == __victim; }); + } + + _Base_iterator + _M_erase(_Base_const_iterator __victim) + { + _M_invalidate(__victim); + size_type __bucket_count = this->bucket_count(); + _Base_iterator __next = _Base::erase(__victim); + _M_check_rehashed(__bucket_count); + return __next; + } + +#if __cplusplus > 201402L + node_type + _M_extract(_Base_const_iterator __victim) + { + _M_invalidate(__victim); + return _Base::extract(__victim); + } +#endif + }; + +#if __cpp_deduction_guides >= 201606 + + template>, + typename _Pred = equal_to<__iter_key_t<_InputIterator>>, + typename _Allocator = allocator<__iter_to_alloc_t<_InputIterator>>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireNotAllocator<_Pred>, + typename = _RequireAllocator<_Allocator>> + unordered_multimap(_InputIterator, _InputIterator, + unordered_multimap::size_type = {}, + _Hash = _Hash(), _Pred = _Pred(), + _Allocator = _Allocator()) + -> unordered_multimap<__iter_key_t<_InputIterator>, + __iter_val_t<_InputIterator>, _Hash, _Pred, + _Allocator>; + + template, + typename _Pred = equal_to<_Key>, + typename _Allocator = allocator>, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireNotAllocator<_Pred>, + typename = _RequireAllocator<_Allocator>> + unordered_multimap(initializer_list>, + unordered_multimap::size_type = {}, + _Hash = _Hash(), _Pred = _Pred(), + _Allocator = _Allocator()) + -> unordered_multimap<_Key, _Tp, _Hash, _Pred, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + unordered_multimap(_InputIterator, _InputIterator, + unordered_multimap::size_type, _Allocator) + -> unordered_multimap<__iter_key_t<_InputIterator>, + __iter_val_t<_InputIterator>, + hash<__iter_key_t<_InputIterator>>, + equal_to<__iter_key_t<_InputIterator>>, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + unordered_multimap(_InputIterator, _InputIterator, _Allocator) + -> unordered_multimap<__iter_key_t<_InputIterator>, + __iter_val_t<_InputIterator>, + hash<__iter_key_t<_InputIterator>>, + equal_to<__iter_key_t<_InputIterator>>, _Allocator>; + + template, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireAllocator<_Allocator>> + unordered_multimap(_InputIterator, _InputIterator, + unordered_multimap::size_type, _Hash, + _Allocator) + -> unordered_multimap<__iter_key_t<_InputIterator>, + __iter_val_t<_InputIterator>, _Hash, + equal_to<__iter_key_t<_InputIterator>>, _Allocator>; + + template> + unordered_multimap(initializer_list>, + unordered_multimap::size_type, + _Allocator) + -> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>; + + template> + unordered_multimap(initializer_list>, _Allocator) + -> unordered_multimap<_Key, _Tp, hash<_Key>, equal_to<_Key>, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + unordered_multimap(initializer_list>, + unordered_multimap::size_type, + _Hash, _Allocator) + -> unordered_multimap<_Key, _Tp, _Hash, equal_to<_Key>, _Allocator>; + +#endif + + template + inline void + swap(unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + inline bool + operator==(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { return __x._M_base() == __y._M_base(); } + +#if __cpp_impl_three_way_comparison < 201907L + template + inline bool + operator!=(const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __x, + const unordered_multimap<_Key, _Tp, _Hash, _Pred, _Alloc>& __y) + { return !(__x == __y); } +#endif + +} // namespace __debug +} // namespace std + +#endif // C++11 + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/unordered_set b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/unordered_set new file mode 100644 index 0000000..c259109 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/unordered_set @@ -0,0 +1,1295 @@ +// Debugging unordered_set/unordered_multiset implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/unordered_set + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_UNORDERED_SET +#define _GLIBCXX_DEBUG_UNORDERED_SET 1 + +#pragma GCC system_header + +#if __cplusplus < 201103L +# include +#else +# include +namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { + template + class unordered_set; + template + class unordered_multiset; +} } // namespace std::__debug +# include + +#include +#include +#include +#include + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::unordered_set with safety/checking/debug instrumentation. + template, + typename _Pred = std::equal_to<_Value>, + typename _Alloc = std::allocator<_Value> > + class unordered_set + : public __gnu_debug::_Safe_container< + unordered_set<_Value, _Hash, _Pred, _Alloc>, _Alloc, + __gnu_debug::_Safe_unordered_container>, + public _GLIBCXX_STD_C::unordered_set<_Value, _Hash, _Pred, _Alloc> + { + typedef _GLIBCXX_STD_C::unordered_set< + _Value, _Hash, _Pred, _Alloc> _Base; + typedef __gnu_debug::_Safe_container< + unordered_set, _Alloc, __gnu_debug::_Safe_unordered_container> _Safe; + + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef typename _Base::const_local_iterator _Base_const_local_iterator; + typedef typename _Base::local_iterator _Base_local_iterator; + + template + friend class ::__gnu_debug::_Safe_iterator; + template + friend class ::__gnu_debug::_Safe_local_iterator; + + // Reference wrapper for base class. See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + typedef typename _Base::size_type size_type; + typedef typename _Base::hasher hasher; + typedef typename _Base::key_equal key_equal; + typedef typename _Base::allocator_type allocator_type; + + typedef typename _Base::key_type key_type; + typedef typename _Base::value_type value_type; + + typedef __gnu_debug::_Safe_iterator< + _Base_iterator, unordered_set> iterator; + typedef __gnu_debug::_Safe_iterator< + _Base_const_iterator, unordered_set> const_iterator; + typedef __gnu_debug::_Safe_local_iterator< + _Base_local_iterator, unordered_set> local_iterator; + typedef __gnu_debug::_Safe_local_iterator< + _Base_const_local_iterator, unordered_set> const_local_iterator; + + unordered_set() = default; + + explicit + unordered_set(size_type __n, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__n, __hf, __eql, __a) { } + + template + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __n, + __hf, __eql, __a) { } + + unordered_set(const unordered_set&) = default; + + unordered_set(_Base_ref __x) + : _Base(__x._M_ref) { } + + unordered_set(unordered_set&&) = default; + + explicit + unordered_set(const allocator_type& __a) + : _Base(__a) { } + + unordered_set(const unordered_set& __uset, + const allocator_type& __a) + : _Base(__uset, __a) { } + + unordered_set(unordered_set&& __uset, + const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__uset._M_base()), __a)) ) + : _Safe(std::move(__uset._M_safe()), __a), + _Base(std::move(__uset._M_base()), __a) { } + + unordered_set(initializer_list __l, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __n, __hf, __eql, __a) { } + + unordered_set(size_type __n, const allocator_type& __a) + : unordered_set(__n, hasher(), key_equal(), __a) + { } + + unordered_set(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__n, __hf, key_equal(), __a) + { } + + template + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template + unordered_set(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_set(initializer_list __l, + size_type __n, + const allocator_type& __a) + : unordered_set(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_set(initializer_list __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_set(__l, __n, __hf, key_equal(), __a) + { } + + ~unordered_set() = default; + + unordered_set& + operator=(const unordered_set&) = default; + + unordered_set& + operator=(unordered_set&&) = default; + + unordered_set& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + return *this; + } + + void + swap(unordered_set& __x) + noexcept( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() noexcept + { + _Base::clear(); + this->_M_invalidate_all(); + } + + iterator + begin() noexcept + { return { _Base::begin(), this }; } + + const_iterator + begin() const noexcept + { return { _Base::begin(), this }; } + + iterator + end() noexcept + { return { _Base::end(), this }; } + + const_iterator + end() const noexcept + { return { _Base::end(), this }; } + + const_iterator + cbegin() const noexcept + { return { _Base::cbegin(), this }; } + + const_iterator + cend() const noexcept + { return { _Base::cend(), this }; } + + // local versions + local_iterator + begin(size_type __b) + { + __glibcxx_check_bucket_index(__b); + return { _Base::begin(__b), this }; + } + + local_iterator + end(size_type __b) + { + __glibcxx_check_bucket_index(__b); + return { _Base::end(__b), this }; + } + + const_local_iterator + begin(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::begin(__b), this }; + } + + const_local_iterator + end(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::end(__b), this }; + } + + const_local_iterator + cbegin(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::cbegin(__b), this }; + } + + const_local_iterator + cend(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::cend(__b), this }; + } + + size_type + bucket_size(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return _Base::bucket_size(__b); + } + + float + max_load_factor() const noexcept + { return _Base::max_load_factor(); } + + void + max_load_factor(float __f) + { + __glibcxx_check_max_load_factor(__f); + _Base::max_load_factor(__f); + } + + template + std::pair + emplace(_Args&&... __args) + { + size_type __bucket_count = this->bucket_count(); + auto __res = _Base::emplace(std::forward<_Args>(__args)...); + _M_check_rehashed(__bucket_count); + return { { __res.first, this }, __res.second }; + } + + template + iterator + emplace_hint(const_iterator __hint, _Args&&... __args) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::emplace_hint(__hint.base(), + std::forward<_Args>(__args)...); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + std::pair + insert(const value_type& __obj) + { + size_type __bucket_count = this->bucket_count(); + auto __res = _Base::insert(__obj); + _M_check_rehashed(__bucket_count); + return { { __res.first, this }, __res.second }; + } + + iterator + insert(const_iterator __hint, const value_type& __obj) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__hint.base(), __obj); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + std::pair + insert(value_type&& __obj) + { + size_type __bucket_count = this->bucket_count(); + auto __res = _Base::insert(std::move(__obj)); + _M_check_rehashed(__bucket_count); + return { { __res.first, this }, __res.second }; + } + + iterator + insert(const_iterator __hint, value_type&& __obj) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__hint.base(), std::move(__obj)); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + void + insert(std::initializer_list __l) + { + size_type __bucket_count = this->bucket_count(); + _Base::insert(__l); + _M_check_rehashed(__bucket_count); + } + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + size_type __bucket_count = this->bucket_count(); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + + _M_check_rehashed(__bucket_count); + } + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + using insert_return_type = _Node_insert_return; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + return _M_extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = _Base::find(__key); + if (__position != _Base::end()) + return _M_extract(__position); + return {}; + } + + insert_return_type + insert(node_type&& __nh) + { + auto __ret = _Base::insert(std::move(__nh)); + return + { { __ret.position, this }, __ret.inserted, std::move(__ret.node) }; + } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return { _Base::insert(__hint.base(), std::move(__nh)), this }; + } + + using _Base::merge; +#endif // C++17 + + iterator + find(const key_type& __key) + { return { _Base::find(__key), this }; } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + iterator + find(const _Kt& __k) + { return { _Base::find(__k), this }; } +#endif + + const_iterator + find(const key_type& __key) const + { return { _Base::find(__key), this }; } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + const_iterator + find(const _Kt& __k) const + { return { _Base::find(__k), this }; } +#endif + + std::pair + equal_range(const key_type& __key) + { + auto __res = _Base::equal_range(__key); + return { { __res.first, this }, { __res.second, this } }; + } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + std::pair + equal_range(const _Kt& __k) + { + auto __res = _Base::equal_range(__k); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + std::pair + equal_range(const key_type& __key) const + { + auto __res = _Base::equal_range(__key); + return { { __res.first, this }, { __res.second, this } }; + } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + std::pair + equal_range(const _Kt& __k) const + { + auto __res = _Base::equal_range(__k); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + size_type + erase(const key_type& __key) + { + size_type __ret(0); + auto __victim = _Base::find(__key); + if (__victim != _Base::end()) + { + _M_erase(__victim); + __ret = 1; + } + return __ret; + } + + iterator + erase(const_iterator __it) + { + __glibcxx_check_erase(__it); + return { _M_erase(__it.base()), this }; + } + + iterator + erase(iterator __it) + { + __glibcxx_check_erase(__it); + return { _M_erase(__it.base()), this }; + } + + iterator + erase(const_iterator __first, const_iterator __last) + { + __glibcxx_check_erase_range(__first, __last); + for (auto __tmp = __first.base(); __tmp != __last.base(); ++__tmp) + { + _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::cend(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + _M_invalidate(__tmp); + } + + size_type __bucket_count = this->bucket_count(); + auto __next = _Base::erase(__first.base(), __last.base()); + _M_check_rehashed(__bucket_count); + return { __next, this }; + } + + _Base& + _M_base() noexcept { return *this; } + + const _Base& + _M_base() const noexcept { return *this; } + + private: + void + _M_check_rehashed(size_type __prev_count) + { + if (__prev_count != this->bucket_count()) + this->_M_invalidate_all(); + } + + void + _M_invalidate(_Base_const_iterator __victim) + { + this->_M_invalidate_if( + [__victim](_Base_const_iterator __it) { return __it == __victim; }); + this->_M_invalidate_local_if( + [__victim](_Base_const_local_iterator __it) + { return __it == __victim; }); + } + + _Base_iterator + _M_erase(_Base_const_iterator __victim) + { + _M_invalidate(__victim); + size_type __bucket_count = this->bucket_count(); + _Base_iterator __next = _Base::erase(__victim); + _M_check_rehashed(__bucket_count); + return __next; + } + +#if __cplusplus > 201402L + node_type + _M_extract(_Base_const_iterator __victim) + { + _M_invalidate(__victim); + return _Base::extract(__victim); + } +#endif + }; + +#if __cpp_deduction_guides >= 201606 + + template::value_type>, + typename _Pred = + equal_to::value_type>, + typename _Allocator = + allocator::value_type>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireNotAllocator<_Pred>, + typename = _RequireAllocator<_Allocator>> + unordered_set(_InputIterator, _InputIterator, + unordered_set::size_type = {}, + _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) + -> unordered_set::value_type, + _Hash, _Pred, _Allocator>; + + template, + typename _Pred = equal_to<_Tp>, + typename _Allocator = allocator<_Tp>, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireNotAllocator<_Pred>, + typename = _RequireAllocator<_Allocator>> + unordered_set(initializer_list<_Tp>, + unordered_set::size_type = {}, + _Hash = _Hash(), _Pred = _Pred(), _Allocator = _Allocator()) + -> unordered_set<_Tp, _Hash, _Pred, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + unordered_set(_InputIterator, _InputIterator, + unordered_set::size_type, _Allocator) + -> unordered_set::value_type, + hash< + typename iterator_traits<_InputIterator>::value_type>, + equal_to< + typename iterator_traits<_InputIterator>::value_type>, + _Allocator>; + + template, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireAllocator<_Allocator>> + unordered_set(_InputIterator, _InputIterator, + unordered_set::size_type, + _Hash, _Allocator) + -> unordered_set::value_type, + _Hash, + equal_to< + typename iterator_traits<_InputIterator>::value_type>, + _Allocator>; + + template> + unordered_set(initializer_list<_Tp>, + unordered_set::size_type, _Allocator) + -> unordered_set<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + unordered_set(initializer_list<_Tp>, + unordered_set::size_type, _Hash, _Allocator) + -> unordered_set<_Tp, _Hash, equal_to<_Tp>, _Allocator>; + +#endif + + template + inline void + swap(unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, + unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + inline bool + operator==(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, + const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) + { return __x._M_base() == __y._M_base(); } + +#if __cpp_impl_three_way_comparison < 201907L + template + inline bool + operator!=(const unordered_set<_Value, _Hash, _Pred, _Alloc>& __x, + const unordered_set<_Value, _Hash, _Pred, _Alloc>& __y) + { return !(__x == __y); } +#endif + + /// Class std::unordered_multiset with safety/checking/debug instrumentation. + template, + typename _Pred = std::equal_to<_Value>, + typename _Alloc = std::allocator<_Value> > + class unordered_multiset + : public __gnu_debug::_Safe_container< + unordered_multiset<_Value, _Hash, _Pred, _Alloc>, _Alloc, + __gnu_debug::_Safe_unordered_container>, + public _GLIBCXX_STD_C::unordered_multiset<_Value, _Hash, _Pred, _Alloc> + { + typedef _GLIBCXX_STD_C::unordered_multiset< + _Value, _Hash, _Pred, _Alloc> _Base; + typedef __gnu_debug::_Safe_container _Safe; + typedef typename _Base::const_iterator _Base_const_iterator; + typedef typename _Base::iterator _Base_iterator; + typedef typename _Base::const_local_iterator + _Base_const_local_iterator; + typedef typename _Base::local_iterator _Base_local_iterator; + + template + friend class ::__gnu_debug::_Safe_iterator; + template + friend class ::__gnu_debug::_Safe_local_iterator; + + // Reference wrapper for base class. See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + typedef typename _Base::size_type size_type; + typedef typename _Base::hasher hasher; + typedef typename _Base::key_equal key_equal; + typedef typename _Base::allocator_type allocator_type; + + typedef typename _Base::key_type key_type; + typedef typename _Base::value_type value_type; + + typedef __gnu_debug::_Safe_iterator< + _Base_iterator, unordered_multiset> iterator; + typedef __gnu_debug::_Safe_iterator< + _Base_const_iterator, unordered_multiset> const_iterator; + typedef __gnu_debug::_Safe_local_iterator< + _Base_local_iterator, unordered_multiset> local_iterator; + typedef __gnu_debug::_Safe_local_iterator< + _Base_const_local_iterator, unordered_multiset> const_local_iterator; + + unordered_multiset() = default; + + explicit + unordered_multiset(size_type __n, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__n, __hf, __eql, __a) { } + + template + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __n, + __hf, __eql, __a) { } + + unordered_multiset(const unordered_multiset&) = default; + + unordered_multiset(_Base_ref __x) + : _Base(__x._M_ref) { } + + unordered_multiset(unordered_multiset&&) = default; + + explicit + unordered_multiset(const allocator_type& __a) + : _Base(__a) { } + + unordered_multiset(const unordered_multiset& __uset, + const allocator_type& __a) + : _Base(__uset, __a) { } + + unordered_multiset(unordered_multiset&& __uset, + const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__uset._M_base()), __a)) ) + : _Safe(std::move(__uset._M_safe()), __a), + _Base(std::move(__uset._M_base()), __a) { } + + unordered_multiset(initializer_list __l, + size_type __n = 0, + const hasher& __hf = hasher(), + const key_equal& __eql = key_equal(), + const allocator_type& __a = allocator_type()) + : _Base(__l, __n, __hf, __eql, __a) { } + + unordered_multiset(size_type __n, const allocator_type& __a) + : unordered_multiset(__n, hasher(), key_equal(), __a) + { } + + unordered_multiset(size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__n, __hf, key_equal(), __a) + { } + + template + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n, + const allocator_type& __a) + : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) + { } + + template + unordered_multiset(_InputIterator __first, _InputIterator __last, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) + { } + + unordered_multiset(initializer_list __l, + size_type __n, + const allocator_type& __a) + : unordered_multiset(__l, __n, hasher(), key_equal(), __a) + { } + + unordered_multiset(initializer_list __l, + size_type __n, const hasher& __hf, + const allocator_type& __a) + : unordered_multiset(__l, __n, __hf, key_equal(), __a) + { } + + ~unordered_multiset() = default; + + unordered_multiset& + operator=(const unordered_multiset&) = default; + + unordered_multiset& + operator=(unordered_multiset&&) = default; + + unordered_multiset& + operator=(initializer_list __l) + { + this->_M_base() = __l; + this->_M_invalidate_all(); + return *this; + } + + void + swap(unordered_multiset& __x) + noexcept( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + } + + void + clear() noexcept + { + _Base::clear(); + this->_M_invalidate_all(); + } + + iterator + begin() noexcept + { return { _Base::begin(), this }; } + + const_iterator + begin() const noexcept + { return { _Base::begin(), this }; } + + iterator + end() noexcept + { return { _Base::end(), this }; } + + const_iterator + end() const noexcept + { return { _Base::end(), this }; } + + const_iterator + cbegin() const noexcept + { return { _Base::cbegin(), this }; } + + const_iterator + cend() const noexcept + { return { _Base::cend(), this }; } + + // local versions + local_iterator + begin(size_type __b) + { + __glibcxx_check_bucket_index(__b); + return { _Base::begin(__b), this }; + } + + local_iterator + end(size_type __b) + { + __glibcxx_check_bucket_index(__b); + return { _Base::end(__b), this }; + } + + const_local_iterator + begin(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::begin(__b), this }; + } + + const_local_iterator + end(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::end(__b), this }; + } + + const_local_iterator + cbegin(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::cbegin(__b), this }; + } + + const_local_iterator + cend(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return { _Base::cend(__b), this }; + } + + size_type + bucket_size(size_type __b) const + { + __glibcxx_check_bucket_index(__b); + return _Base::bucket_size(__b); + } + + float + max_load_factor() const noexcept + { return _Base::max_load_factor(); } + + void + max_load_factor(float __f) + { + __glibcxx_check_max_load_factor(__f); + _Base::max_load_factor(__f); + } + + template + iterator + emplace(_Args&&... __args) + { + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::emplace(std::forward<_Args>(__args)...); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + template + iterator + emplace_hint(const_iterator __hint, _Args&&... __args) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::emplace_hint(__hint.base(), + std::forward<_Args>(__args)...); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + iterator + insert(const value_type& __obj) + { + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__obj); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + iterator + insert(const_iterator __hint, const value_type& __obj) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__hint.base(), __obj); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + iterator + insert(value_type&& __obj) + { + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(std::move(__obj)); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + iterator + insert(const_iterator __hint, value_type&& __obj) + { + __glibcxx_check_insert(__hint); + size_type __bucket_count = this->bucket_count(); + auto __it = _Base::insert(__hint.base(), std::move(__obj)); + _M_check_rehashed(__bucket_count); + return { __it, this }; + } + + void + insert(std::initializer_list __l) + { + size_type __bucket_count = this->bucket_count(); + _Base::insert(__l); + _M_check_rehashed(__bucket_count); + } + + template + void + insert(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + size_type __bucket_count = this->bucket_count(); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__first, __last); + + _M_check_rehashed(__bucket_count); + } + +#if __cplusplus > 201402L + using node_type = typename _Base::node_type; + + node_type + extract(const_iterator __position) + { + __glibcxx_check_erase(__position); + return _M_extract(__position.base()); + } + + node_type + extract(const key_type& __key) + { + const auto __position = _Base::find(__key); + if (__position != _Base::end()) + return _M_extract(__position); + return {}; + } + + iterator + insert(node_type&& __nh) + { return { _Base::insert(std::move(__nh)), this }; } + + iterator + insert(const_iterator __hint, node_type&& __nh) + { + __glibcxx_check_insert(__hint); + return { _Base::insert(__hint.base(), std::move(__nh)), this }; + } + + using _Base::merge; +#endif // C++17 + + iterator + find(const key_type& __key) + { return { _Base::find(__key), this }; } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + iterator + find(const _Kt& __k) + { return { _Base::find(__k), this }; } +#endif + + const_iterator + find(const key_type& __key) const + { return { _Base::find(__key), this }; } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + const_iterator + find(const _Kt& __k) const + { return { _Base::find(__k), this }; } +#endif + + std::pair + equal_range(const key_type& __key) + { + auto __res = _Base::equal_range(__key); + return { { __res.first, this }, { __res.second, this } }; + } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + std::pair + equal_range(const _Kt& __k) + { + auto __res = _Base::equal_range(__k); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + std::pair + equal_range(const key_type& __key) const + { + auto __res = _Base::equal_range(__key); + return { { __res.first, this }, { __res.second, this } }; + } + +#if __cplusplus > 201703L + template, + typename = std::__has_is_transparent_t<_Pred, _Kt>> + std::pair + equal_range(const _Kt& __k) const + { + auto __res = _Base::equal_range(__k); + return { { __res.first, this }, { __res.second, this } }; + } +#endif + + size_type + erase(const key_type& __key) + { + size_type __ret(0); + auto __pair = _Base::equal_range(__key); + for (auto __victim = __pair.first; __victim != __pair.second;) + { + _M_invalidate(__victim); + __victim = _Base::erase(__victim); + ++__ret; + } + + return __ret; + } + + iterator + erase(const_iterator __it) + { + __glibcxx_check_erase(__it); + return { _M_erase(__it.base()), this }; + } + + iterator + erase(iterator __it) + { + __glibcxx_check_erase(__it); + return { _M_erase(__it.base()), this }; + } + + iterator + erase(const_iterator __first, const_iterator __last) + { + __glibcxx_check_erase_range(__first, __last); + for (auto __tmp = __first.base(); __tmp != __last.base(); ++__tmp) + { + _GLIBCXX_DEBUG_VERIFY(__tmp != _Base::cend(), + _M_message(__gnu_debug::__msg_valid_range) + ._M_iterator(__first, "first") + ._M_iterator(__last, "last")); + _M_invalidate(__tmp); + } + return { _Base::erase(__first.base(), __last.base()), this }; + } + + _Base& + _M_base() noexcept { return *this; } + + const _Base& + _M_base() const noexcept { return *this; } + + private: + void + _M_check_rehashed(size_type __prev_count) + { + if (__prev_count != this->bucket_count()) + this->_M_invalidate_all(); + } + + void + _M_invalidate(_Base_const_iterator __victim) + { + this->_M_invalidate_if( + [__victim](_Base_const_iterator __it) { return __it == __victim; }); + this->_M_invalidate_local_if( + [__victim](_Base_const_local_iterator __it) + { return __it == __victim; }); + } + + _Base_iterator + _M_erase(_Base_const_iterator __victim) + { + _M_invalidate(__victim); + size_type __bucket_count = this->bucket_count(); + _Base_iterator __next = _Base::erase(__victim); + _M_check_rehashed(__bucket_count); + return __next; + } + +#if __cplusplus > 201402L + node_type + _M_extract(_Base_const_iterator __victim) + { + _M_invalidate(__victim); + return _Base::extract(__victim); + } +#endif + }; + +#if __cpp_deduction_guides >= 201606 + + template::value_type>, + typename _Pred = + equal_to::value_type>, + typename _Allocator = + allocator::value_type>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireNotAllocator<_Pred>, + typename = _RequireAllocator<_Allocator>> + unordered_multiset(_InputIterator, _InputIterator, + unordered_multiset::size_type = {}, + _Hash = _Hash(), _Pred = _Pred(), + _Allocator = _Allocator()) + -> unordered_multiset::value_type, + _Hash, _Pred, _Allocator>; + + template, + typename _Pred = equal_to<_Tp>, + typename _Allocator = allocator<_Tp>, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireNotAllocator<_Pred>, + typename = _RequireAllocator<_Allocator>> + unordered_multiset(initializer_list<_Tp>, + unordered_multiset::size_type = {}, + _Hash = _Hash(), _Pred = _Pred(), + _Allocator = _Allocator()) + -> unordered_multiset<_Tp, _Hash, _Pred, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + unordered_multiset(_InputIterator, _InputIterator, + unordered_multiset::size_type, _Allocator) + -> unordered_multiset::value_type, + hash::value_type>, + equal_to::value_type>, + _Allocator>; + + template, + typename = _RequireNotAllocatorOrIntegral<_Hash>, + typename = _RequireAllocator<_Allocator>> + unordered_multiset(_InputIterator, _InputIterator, + unordered_multiset::size_type, + _Hash, _Allocator) + -> unordered_multiset::value_type, + _Hash, + equal_to< + typename + iterator_traits<_InputIterator>::value_type>, + _Allocator>; + + template> + unordered_multiset(initializer_list<_Tp>, + unordered_multiset::size_type, _Allocator) + -> unordered_multiset<_Tp, hash<_Tp>, equal_to<_Tp>, _Allocator>; + + template, + typename = _RequireAllocator<_Allocator>> + unordered_multiset(initializer_list<_Tp>, + unordered_multiset::size_type, _Hash, _Allocator) + -> unordered_multiset<_Tp, _Hash, equal_to<_Tp>, _Allocator>; + +#endif + + template + inline void + swap(unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, + unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) + noexcept(noexcept(__x.swap(__y))) + { __x.swap(__y); } + + template + inline bool + operator==(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, + const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) + { return __x._M_base() == __y._M_base(); } + +#if __cpp_impl_three_way_comparison < 201907L + template + inline bool + operator!=(const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __x, + const unordered_multiset<_Value, _Hash, _Pred, _Alloc>& __y) + { return !(__x == __y); } +#endif + +} // namespace __debug +} // namespace std + +#endif // C++11 + +#endif diff --git a/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/vector b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/vector new file mode 100644 index 0000000..987bba1 --- /dev/null +++ b/external/ps2sdk/ee/mips64r5900el-ps2-elf/include/c++/11.2.0/debug/vector @@ -0,0 +1,845 @@ +// Debugging vector implementation -*- C++ -*- + +// Copyright (C) 2003-2021 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 +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// Under Section 7 of GPL version 3, you are granted additional +// permissions described in the GCC Runtime Library Exception, version +// 3.1, as published by the Free Software Foundation. + +// You should have received a copy of the GNU General Public License and +// a copy of the GCC Runtime Library Exception along with this program; +// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see +// . + +/** @file debug/vector + * This file is a GNU debug extension to the Standard C++ Library. + */ + +#ifndef _GLIBCXX_DEBUG_VECTOR +#define _GLIBCXX_DEBUG_VECTOR 1 + +#pragma GCC system_header + +#include +namespace std _GLIBCXX_VISIBILITY(default) { namespace __debug { + template class vector; +} } // namespace std::__debug + +#include +#include +#include +#include +#include + +namespace __gnu_debug +{ + /** @brief Base class for Debug Mode vector. + * + * Adds information about the guaranteed capacity, which is useful for + * detecting code which relies on non-portable implementation details of + * the libstdc++ reallocation policy. + */ + template + class _Safe_vector + { + typedef typename _BaseSequence::size_type size_type; + + const _SafeSequence& + _M_seq() const { return *static_cast(this); } + + protected: + _Safe_vector() _GLIBCXX_NOEXCEPT + : _M_guaranteed_capacity(0) + { _M_update_guaranteed_capacity(); } + + _Safe_vector(const _Safe_vector&) _GLIBCXX_NOEXCEPT + : _M_guaranteed_capacity(0) + { _M_update_guaranteed_capacity(); } + + _Safe_vector(size_type __n) _GLIBCXX_NOEXCEPT + : _M_guaranteed_capacity(__n) + { } + +#if __cplusplus >= 201103L + _Safe_vector(_Safe_vector&& __x) noexcept + : _Safe_vector() + { __x._M_guaranteed_capacity = 0; } + + _Safe_vector& + operator=(const _Safe_vector&) noexcept + { + _M_update_guaranteed_capacity(); + return *this; + } + + _Safe_vector& + operator=(_Safe_vector&& __x) noexcept + { + _M_update_guaranteed_capacity(); + __x._M_guaranteed_capacity = 0; + return *this; + } +#endif + + size_type _M_guaranteed_capacity; + + bool + _M_requires_reallocation(size_type __elements) const _GLIBCXX_NOEXCEPT + { return __elements > _M_seq().capacity(); } + + void + _M_update_guaranteed_capacity() _GLIBCXX_NOEXCEPT + { + if (_M_seq().size() > _M_guaranteed_capacity) + _M_guaranteed_capacity = _M_seq().size(); + } + }; +} + +namespace std _GLIBCXX_VISIBILITY(default) +{ +namespace __debug +{ + /// Class std::vector with safety/checking/debug instrumentation. + template > + class vector + : public __gnu_debug::_Safe_container< + vector<_Tp, _Allocator>, _Allocator, __gnu_debug::_Safe_sequence>, + public _GLIBCXX_STD_C::vector<_Tp, _Allocator>, + public __gnu_debug::_Safe_vector< + vector<_Tp, _Allocator>, + _GLIBCXX_STD_C::vector<_Tp, _Allocator> > + { + typedef _GLIBCXX_STD_C::vector<_Tp, _Allocator> _Base; + typedef __gnu_debug::_Safe_container< + vector, _Allocator, __gnu_debug::_Safe_sequence> _Safe; + typedef __gnu_debug::_Safe_vector _Safe_vector; + + typedef typename _Base::iterator _Base_iterator; + typedef typename _Base::const_iterator _Base_const_iterator; + typedef __gnu_debug::_Equal_to<_Base_const_iterator> _Equal; + + template + friend class ::__gnu_debug::_Safe_iterator; + + // Reference wrapper for base class. Disambiguates vector(const _Base&) + // from copy constructor by requiring a user-defined conversion. + // See PR libstdc++/90102. + struct _Base_ref + { + _Base_ref(const _Base& __r) : _M_ref(__r) { } + + const _Base& _M_ref; + }; + + public: + typedef typename _Base::reference reference; + typedef typename _Base::const_reference const_reference; + + typedef __gnu_debug::_Safe_iterator< + _Base_iterator, vector> iterator; + typedef __gnu_debug::_Safe_iterator< + _Base_const_iterator, vector> const_iterator; + + typedef typename _Base::size_type size_type; + typedef typename _Base::difference_type difference_type; + + typedef _Tp value_type; + typedef _Allocator allocator_type; + typedef typename _Base::pointer pointer; + typedef typename _Base::const_pointer const_pointer; + typedef std::reverse_iterator reverse_iterator; + typedef std::reverse_iterator const_reverse_iterator; + + // 23.2.4.1 construct/copy/destroy: + +#if __cplusplus < 201103L + vector() _GLIBCXX_NOEXCEPT + : _Base() { } +#else + vector() = default; +#endif + + explicit + vector(const _Allocator& __a) _GLIBCXX_NOEXCEPT + : _Base(__a) { } + +#if __cplusplus >= 201103L + explicit + vector(size_type __n, const _Allocator& __a = _Allocator()) + : _Base(__n, __a), _Safe_vector(__n) { } + + vector(size_type __n, const _Tp& __value, + const _Allocator& __a = _Allocator()) + : _Base(__n, __value, __a) { } +#else + explicit + vector(size_type __n, const _Tp& __value = _Tp(), + const _Allocator& __a = _Allocator()) + : _Base(__n, __value, __a) { } +#endif + +#if __cplusplus >= 201103L + template> +#else + template +#endif + vector(_InputIterator __first, _InputIterator __last, + const _Allocator& __a = _Allocator()) + : _Base(__gnu_debug::__base( + __glibcxx_check_valid_constructor_range(__first, __last)), + __gnu_debug::__base(__last), __a) { } + +#if __cplusplus < 201103L + vector(const vector& __x) + : _Base(__x) { } + + ~vector() _GLIBCXX_NOEXCEPT { } +#else + vector(const vector&) = default; + vector(vector&&) = default; + + vector(const vector& __x, const allocator_type& __a) + : _Base(__x, __a) { } + + vector(vector&& __x, const allocator_type& __a) + noexcept( + std::is_nothrow_constructible<_Base, + _Base, const allocator_type&>::value ) + : _Safe(std::move(__x._M_safe()), __a), + _Base(std::move(__x._M_base()), __a), + _Safe_vector(std::move(__x)) { } + + vector(initializer_list __l, + const allocator_type& __a = allocator_type()) + : _Base(__l, __a) { } + + ~vector() = default; +#endif + + /// Construction from a normal-mode vector + vector(_Base_ref __x) + : _Base(__x._M_ref) { } + +#if __cplusplus < 201103L + vector& + operator=(const vector& __x) + { + this->_M_safe() = __x; + _M_base() = __x; + this->_M_update_guaranteed_capacity(); + return *this; + } +#else + vector& + operator=(const vector&) = default; + + vector& + operator=(vector&&) = default; + + vector& + operator=(initializer_list __l) + { + _M_base() = __l; + this->_M_invalidate_all(); + this->_M_update_guaranteed_capacity(); + return *this; + } +#endif + +#if __cplusplus >= 201103L + template> +#else + template +#endif + void + assign(_InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_valid_range2(__first, __last, __dist); + + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::assign(__gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::assign(__first, __last); + + this->_M_invalidate_all(); + this->_M_update_guaranteed_capacity(); + } + + void + assign(size_type __n, const _Tp& __u) + { + _Base::assign(__n, __u); + this->_M_invalidate_all(); + this->_M_update_guaranteed_capacity(); + } + +#if __cplusplus >= 201103L + void + assign(initializer_list __l) + { + _Base::assign(__l); + this->_M_invalidate_all(); + this->_M_update_guaranteed_capacity(); + } +#endif + + using _Base::get_allocator; + + // iterators: + iterator + begin() _GLIBCXX_NOEXCEPT + { return iterator(_Base::begin(), this); } + + const_iterator + begin() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::begin(), this); } + + iterator + end() _GLIBCXX_NOEXCEPT + { return iterator(_Base::end(), this); } + + const_iterator + end() const _GLIBCXX_NOEXCEPT + { return const_iterator(_Base::end(), this); } + + reverse_iterator + rbegin() _GLIBCXX_NOEXCEPT + { return reverse_iterator(end()); } + + const_reverse_iterator + rbegin() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(end()); } + + reverse_iterator + rend() _GLIBCXX_NOEXCEPT + { return reverse_iterator(begin()); } + + const_reverse_iterator + rend() const _GLIBCXX_NOEXCEPT + { return const_reverse_iterator(begin()); } + +#if __cplusplus >= 201103L + const_iterator + cbegin() const noexcept + { return const_iterator(_Base::begin(), this); } + + const_iterator + cend() const noexcept + { return const_iterator(_Base::end(), this); } + + const_reverse_iterator + crbegin() const noexcept + { return const_reverse_iterator(end()); } + + const_reverse_iterator + crend() const noexcept + { return const_reverse_iterator(begin()); } +#endif + + // 23.2.4.2 capacity: + using _Base::size; + using _Base::max_size; + +#if __cplusplus >= 201103L + void + resize(size_type __sz) + { + bool __realloc = this->_M_requires_reallocation(__sz); + if (__sz < this->size()) + this->_M_invalidate_after_nth(__sz); + _Base::resize(__sz); + if (__realloc) + this->_M_invalidate_all(); + this->_M_update_guaranteed_capacity(); + } + + void + resize(size_type __sz, const _Tp& __c) + { + bool __realloc = this->_M_requires_reallocation(__sz); + if (__sz < this->size()) + this->_M_invalidate_after_nth(__sz); + _Base::resize(__sz, __c); + if (__realloc) + this->_M_invalidate_all(); + this->_M_update_guaranteed_capacity(); + } +#else + void + resize(size_type __sz, _Tp __c = _Tp()) + { + bool __realloc = this->_M_requires_reallocation(__sz); + if (__sz < this->size()) + this->_M_invalidate_after_nth(__sz); + _Base::resize(__sz, __c); + if (__realloc) + this->_M_invalidate_all(); + this->_M_update_guaranteed_capacity(); + } +#endif + +#if __cplusplus >= 201103L + void + shrink_to_fit() + { + if (_Base::_M_shrink_to_fit()) + { + this->_M_guaranteed_capacity = _Base::capacity(); + this->_M_invalidate_all(); + } + } +#endif + + size_type + capacity() const _GLIBCXX_NOEXCEPT + { +#ifdef _GLIBCXX_DEBUG_PEDANTIC + return this->_M_guaranteed_capacity; +#else + return _Base::capacity(); +#endif + } + + using _Base::empty; + + void + reserve(size_type __n) + { + bool __realloc = this->_M_requires_reallocation(__n); + _Base::reserve(__n); + if (__n > this->_M_guaranteed_capacity) + this->_M_guaranteed_capacity = __n; + if (__realloc) + this->_M_invalidate_all(); + } + + // element access: + reference + operator[](size_type __n) _GLIBCXX_NOEXCEPT + { + __glibcxx_check_subscript(__n); + return _M_base()[__n]; + } + + const_reference + operator[](size_type __n) const _GLIBCXX_NOEXCEPT + { + __glibcxx_check_subscript(__n); + return _M_base()[__n]; + } + + using _Base::at; + + reference + front() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::front(); + } + + const_reference + front() const _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::front(); + } + + reference + back() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::back(); + } + + const_reference + back() const _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + return _Base::back(); + } + + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // DR 464. Suggestion for new member functions in standard containers. + using _Base::data; + + // 23.2.4.3 modifiers: + void + push_back(const _Tp& __x) + { + bool __realloc = this->_M_requires_reallocation(this->size() + 1); + _Base::push_back(__x); + if (__realloc) + this->_M_invalidate_all(); + this->_M_update_guaranteed_capacity(); + } + +#if __cplusplus >= 201103L + template + typename __gnu_cxx::__enable_if::__value, + void>::__type + push_back(_Tp&& __x) + { emplace_back(std::move(__x)); } + + template +#if __cplusplus > 201402L + reference +#else + void +#endif + emplace_back(_Args&&... __args) + { + bool __realloc = this->_M_requires_reallocation(this->size() + 1); + _Base::emplace_back(std::forward<_Args>(__args)...); + if (__realloc) + this->_M_invalidate_all(); + this->_M_update_guaranteed_capacity(); +#if __cplusplus > 201402L + return back(); +#endif + } +#endif + + void + pop_back() _GLIBCXX_NOEXCEPT + { + __glibcxx_check_nonempty(); + this->_M_invalidate_if(_Equal(--_Base::end())); + _Base::pop_back(); + } + +#if __cplusplus >= 201103L + template + iterator + emplace(const_iterator __position, _Args&&... __args) + { + __glibcxx_check_insert(__position); + bool __realloc = this->_M_requires_reallocation(this->size() + 1); + difference_type __offset = __position.base() - _Base::cbegin(); + _Base_iterator __res = _Base::emplace(__position.base(), + std::forward<_Args>(__args)...); + if (__realloc) + this->_M_invalidate_all(); + else + this->_M_invalidate_after_nth(__offset); + this->_M_update_guaranteed_capacity(); + return { __res, this }; + } +#endif + + iterator +#if __cplusplus >= 201103L + insert(const_iterator __position, const _Tp& __x) +#else + insert(iterator __position, const _Tp& __x) +#endif + { + __glibcxx_check_insert(__position); + bool __realloc = this->_M_requires_reallocation(this->size() + 1); + difference_type __offset = __position.base() - _Base::begin(); + _Base_iterator __res = _Base::insert(__position.base(), __x); + if (__realloc) + this->_M_invalidate_all(); + else + this->_M_invalidate_after_nth(__offset); + this->_M_update_guaranteed_capacity(); + return iterator(__res, this); + } + +#if __cplusplus >= 201103L + template + typename __gnu_cxx::__enable_if::__value, + iterator>::__type + insert(const_iterator __position, _Tp&& __x) + { return emplace(__position, std::move(__x)); } + + iterator + insert(const_iterator __position, initializer_list __l) + { return this->insert(__position, __l.begin(), __l.end()); } +#endif + +#if __cplusplus >= 201103L + iterator + insert(const_iterator __position, size_type __n, const _Tp& __x) + { + __glibcxx_check_insert(__position); + bool __realloc = this->_M_requires_reallocation(this->size() + __n); + difference_type __offset = __position.base() - _Base::cbegin(); + _Base_iterator __res = _Base::insert(__position.base(), __n, __x); + if (__realloc) + this->_M_invalidate_all(); + else + this->_M_invalidate_after_nth(__offset); + this->_M_update_guaranteed_capacity(); + return { __res, this }; + } +#else + void + insert(iterator __position, size_type __n, const _Tp& __x) + { + __glibcxx_check_insert(__position); + bool __realloc = this->_M_requires_reallocation(this->size() + __n); + difference_type __offset = __position.base() - _Base::begin(); + _Base::insert(__position.base(), __n, __x); + if (__realloc) + this->_M_invalidate_all(); + else + this->_M_invalidate_after_nth(__offset); + this->_M_update_guaranteed_capacity(); + } +#endif + +#if __cplusplus >= 201103L + template> + iterator + insert(const_iterator __position, + _InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_insert_range(__position, __first, __last, __dist); + + /* Hard to guess if invalidation will occur, because __last + - __first can't be calculated in all cases, so we just + punt here by checking if it did occur. */ + _Base_iterator __old_begin = _M_base().begin(); + difference_type __offset = __position.base() - _Base::cbegin(); + _Base_iterator __res; + if (__dist.second >= __gnu_debug::__dp_sign) + __res = _Base::insert(__position.base(), + __gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + __res = _Base::insert(__position.base(), __first, __last); + + if (_M_base().begin() != __old_begin) + this->_M_invalidate_all(); + else + this->_M_invalidate_after_nth(__offset); + this->_M_update_guaranteed_capacity(); + return { __res, this }; + } +#else + template + void + insert(iterator __position, + _InputIterator __first, _InputIterator __last) + { + typename __gnu_debug::_Distance_traits<_InputIterator>::__type __dist; + __glibcxx_check_insert_range(__position, __first, __last, __dist); + + /* Hard to guess if invalidation will occur, because __last + - __first can't be calculated in all cases, so we just + punt here by checking if it did occur. */ + _Base_iterator __old_begin = _M_base().begin(); + difference_type __offset = __position.base() - _Base::begin(); + if (__dist.second >= __gnu_debug::__dp_sign) + _Base::insert(__position.base(), __gnu_debug::__unsafe(__first), + __gnu_debug::__unsafe(__last)); + else + _Base::insert(__position.base(), __first, __last); + + if (_M_base().begin() != __old_begin) + this->_M_invalidate_all(); + else + this->_M_invalidate_after_nth(__offset); + this->_M_update_guaranteed_capacity(); + } +#endif + + iterator +#if __cplusplus >= 201103L + erase(const_iterator __position) +#else + erase(iterator __position) +#endif + { + __glibcxx_check_erase(__position); + difference_type __offset = __position.base() - _Base::begin(); + _Base_iterator __res = _Base::erase(__position.base()); + this->_M_invalidate_after_nth(__offset); + return iterator(__res, this); + } + + iterator +#if __cplusplus >= 201103L + erase(const_iterator __first, const_iterator __last) +#else + erase(iterator __first, iterator __last) +#endif + { + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 151. can't currently clear() empty container + __glibcxx_check_erase_range(__first, __last); + + if (__first.base() != __last.base()) + { + difference_type __offset = __first.base() - _Base::begin(); + _Base_iterator __res = _Base::erase(__first.base(), + __last.base()); + this->_M_invalidate_after_nth(__offset); + return iterator(__res, this); + } + else +#if __cplusplus >= 201103L + return { _Base::begin() + (__first.base() - _Base::cbegin()), this }; +#else + return __first; +#endif + } + + void + swap(vector& __x) + _GLIBCXX_NOEXCEPT_IF( noexcept(declval<_Base&>().swap(__x)) ) + { + _Safe::_M_swap(__x); + _Base::swap(__x); + std::swap(this->_M_guaranteed_capacity, __x._M_guaranteed_capacity); + } + + void + clear() _GLIBCXX_NOEXCEPT + { + _Base::clear(); + this->_M_invalidate_all(); + } + + _Base& + _M_base() _GLIBCXX_NOEXCEPT { return *this; } + + const _Base& + _M_base() const _GLIBCXX_NOEXCEPT { return *this; } + + private: + void + _M_invalidate_after_nth(difference_type __n) _GLIBCXX_NOEXCEPT + { + typedef __gnu_debug::_After_nth_from<_Base_const_iterator> _After_nth; + this->_M_invalidate_if(_After_nth(__n, _Base::begin())); + } + }; + + template + inline bool + operator==(const vector<_Tp, _Alloc>& __lhs, + const vector<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() == __rhs._M_base(); } + +#if __cpp_lib_three_way_comparison + template + constexpr __detail::__synth3way_t<_Tp> + operator<=>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) + { return __x._M_base() <=> __y._M_base(); } +#else + template + inline bool + operator!=(const vector<_Tp, _Alloc>& __lhs, + const vector<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() != __rhs._M_base(); } + + template + inline bool + operator<(const vector<_Tp, _Alloc>& __lhs, + const vector<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() < __rhs._M_base(); } + + template + inline bool + operator<=(const vector<_Tp, _Alloc>& __lhs, + const vector<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() <= __rhs._M_base(); } + + template + inline bool + operator>=(const vector<_Tp, _Alloc>& __lhs, + const vector<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() >= __rhs._M_base(); } + + template + inline bool + operator>(const vector<_Tp, _Alloc>& __lhs, + const vector<_Tp, _Alloc>& __rhs) + { return __lhs._M_base() > __rhs._M_base(); } +#endif // three-way comparison + + template + inline void + swap(vector<_Tp, _Alloc>& __lhs, vector<_Tp, _Alloc>& __rhs) + _GLIBCXX_NOEXCEPT_IF(noexcept(__lhs.swap(__rhs))) + { __lhs.swap(__rhs); } + +#if __cpp_deduction_guides >= 201606 + template::value_type, + typename _Allocator = allocator<_ValT>, + typename = _RequireInputIter<_InputIterator>, + typename = _RequireAllocator<_Allocator>> + vector(_InputIterator, _InputIterator, _Allocator = _Allocator()) + -> vector<_ValT, _Allocator>; +#endif + +} // namespace __debug + +_GLIBCXX_BEGIN_NAMESPACE_VERSION + +#if __cplusplus >= 201103L + // DR 1182. + /// std::hash specialization for vector. + template + struct hash<__debug::vector> + : public __hash_base> + { + size_t + operator()(const __debug::vector& __b) const noexcept + { return std::hash<_GLIBCXX_STD_C::vector>()(__b); } + }; +#endif + +#if __cplusplus >= 201703L + namespace __detail::__variant + { + template struct _Never_valueless_alt; // see + + // Provide the strong exception-safety guarantee when emplacing a + // vector into a variant, but only if move assignment cannot throw. + template + struct _Never_valueless_alt<__debug::vector<_Tp, _Alloc>> + : std::is_nothrow_move_assignable<__debug::vector<_Tp, _Alloc>> + { }; + } // namespace __detail::__variant +#endif // C++17 + +_GLIBCXX_END_NAMESPACE_VERSION +} // namespace std + +namespace __gnu_debug +{ + template + struct _Is_contiguous_sequence > + : std::__true_type + { }; + + template + struct _Is_contiguous_sequence > + : std::__false_type + { }; +} + +#endif diff --git a/external/ps2sdk/ps2sdk/samples/debug/callstacktest/Makefile b/external/ps2sdk/ps2sdk/samples/debug/callstacktest/Makefile new file mode 100644 index 0000000..b0b7945 --- /dev/null +++ b/external/ps2sdk/ps2sdk/samples/debug/callstacktest/Makefile @@ -0,0 +1,25 @@ +# _____ ___ ____ ___ ____ +# ____| | ____| | | |____| +# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. +#----------------------------------------------------------------------- +# Copyright 2001-2004, ps2dev - http://www.ps2dev.org +# Licenced under Academic Free License version 2.0 +# Review ps2sdk README & LICENSE files for further details. + +EE_BIN = callstacktest.elf +EE_OBJS = callstacktest.o +EE_LIBS = -ldebug -lc + +all: $(EE_BIN) + +clean: + rm -f $(EE_BIN) $(EE_OBJS) + +run: $(EE_BIN) + ps2client execee host:$(EE_BIN) + +reset: + ps2client reset + +include $(PS2SDK)/samples/Makefile.pref +include $(PS2SDK)/samples/Makefile.eeglobal diff --git a/external/ps2sdk/ps2sdk/samples/debug/callstacktest/callstacktest.c b/external/ps2sdk/ps2sdk/samples/debug/callstacktest/callstacktest.c new file mode 100644 index 0000000..a0bd981 --- /dev/null +++ b/external/ps2sdk/ps2sdk/samples/debug/callstacktest/callstacktest.c @@ -0,0 +1,54 @@ +/* +# _____ ___ ____ ___ ____ +# ____| | ____| | | |____| +# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. +#----------------------------------------------------------------------- +# Copyright 2001-2004, ps2dev - http://www.ps2dev.org +# Licenced under Academic Free License version 2.0 +# Review ps2sdk README & LICENSE files for further details. +*/ + +#include +#include +#include + +/** A bunch of test function that we use to test the stacktrace. */ + +int TestFunction3() +{ + unsigned int* stackTrace[256]; + int i = 0; + + ps2GetStackTrace((unsigned int*)&stackTrace,256); + + for(i = 0; i < 256; ++i) + { + if (stackTrace[i] == 0) + break; + + printf("adress %d 0x%08x\n",i,(int)stackTrace[i]); + } + + return 0; +} + +int TestFunction2() +{ + return TestFunction3(); +} + +int testFunction1() +{ + return TestFunction2(); +} + +int main() +{ + testFunction1(); + + while(1) + { + } + + return 0; +} diff --git a/external/ps2sdk/ps2sdk/samples/debug/helloworld/Makefile b/external/ps2sdk/ps2sdk/samples/debug/helloworld/Makefile new file mode 100644 index 0000000..623fa5b --- /dev/null +++ b/external/ps2sdk/ps2sdk/samples/debug/helloworld/Makefile @@ -0,0 +1,25 @@ +# _____ ___ ____ ___ ____ +# ____| | ____| | | |____| +# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. +#----------------------------------------------------------------------- +# Copyright 2001-2004, ps2dev - http://www.ps2dev.org +# Licenced under Academic Free License version 2.0 +# Review ps2sdk README & LICENSE files for further details. + +EE_BIN = helloworld.elf +EE_OBJS = helloworld.o +EE_LIBS = -ldebug -lc + +all: $(EE_BIN) + +clean: + rm -f $(EE_BIN) $(EE_OBJS) + +run: $(EE_BIN) + ps2client execee host:$(EE_BIN) + +reset: + ps2client reset + +include $(PS2SDK)/samples/Makefile.pref +include $(PS2SDK)/samples/Makefile.eeglobal diff --git a/external/ps2sdk/ps2sdk/samples/debug/helloworld/helloworld.c b/external/ps2sdk/ps2sdk/samples/debug/helloworld/helloworld.c new file mode 100644 index 0000000..b0a0833 --- /dev/null +++ b/external/ps2sdk/ps2sdk/samples/debug/helloworld/helloworld.c @@ -0,0 +1,35 @@ +/* +# _____ ___ ____ ___ ____ +# ____| | ____| | | |____| +# | ___| |____ ___| ____| | \ PS2DEV Open Source Project. +#----------------------------------------------------------------------- +# Copyright 2001-2004, ps2dev - http://www.ps2dev.org +# Licenced under Academic Free License version 2.0 +# Review ps2sdk README & LICENSE files for further details. +*/ + +#include +#include +#include +#include +#include + +int main(int argc, char *argv[]) +{ + SifInitRpc(0); + init_scr(); + + scr_printf("Hello, World!\n"); + + // After 5 seconds, clear the screen. + sleep(5); + scr_clear(); + + // Move cursor to 20, 20 + scr_setXY(20, 20); + scr_printf("Hello Again, World!\n"); + + sleep(10); + + return 0; +}