diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index ac10fa184c65..b8a0ad251d8b 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -257,7 +257,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 // for details. typedef std::ctype __ctype_type; const __ctype_type& __fctyp(use_facet<__ctype_type>(_M_locale)); - std::vector __s(__first, __last); + _GLIBCXX_STD_C::vector __s(__first, __last); __fctyp.tolower(__s.data(), __s.data() + __s.size()); return this->transform(__s.data(), __s.data() + __s.size()); } @@ -1697,6 +1697,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * [n+3] suffix */ typedef std::vector, _Alloc> _Base_type; + // In debug mode _Base_type is the debug vector, this is the unsafe one: + typedef _GLIBCXX_STD_C::vector, _Alloc> _Unchecked; typedef std::iterator_traits<_Bi_iter> __iter_traits; typedef regex_constants::match_flag_type match_flag_type; @@ -1773,7 +1775,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * @retval true The object has a fully-established result state. * @retval false The object is not ready. */ - bool ready() const noexcept { return !_Base_type::empty(); } + bool ready() const noexcept { return !_Unchecked::empty(); } /** * @name 28.10.2 Size @@ -1791,11 +1793,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 */ size_type size() const noexcept - { return _Base_type::empty() ? 0 : _Base_type::size() - 3; } + { return _Unchecked::empty() ? 0 : _Unchecked::size() - 3; } size_type max_size() const noexcept - { return _Base_type::max_size() - 3; } + { return _Unchecked::max_size() - 3; } /** * @brief Indicates if the %match_results contains no results. @@ -1869,7 +1871,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { __glibcxx_assert( ready() ); return __sub < size() - ? _Base_type::operator[](__sub) + ? _Unchecked::operator[](__sub) : _M_unmatched_sub(); } @@ -2045,7 +2047,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 // (plus additional objects for prefix, suffix and unmatched sub). void _M_resize(unsigned int __size) - { _Base_type::assign(__size + 3, sub_match<_Bi_iter>{}); } + { _Unchecked::assign(__size + 3, sub_match<_Bi_iter>{}); } // Set state to a failed match for the given past-the-end iterator. void @@ -2053,32 +2055,32 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { sub_match<_Bi_iter> __sm; __sm.first = __sm.second = __end; - _Base_type::assign(3, __sm); + _Unchecked::assign(3, __sm); } const_reference _M_unmatched_sub() const - { return _Base_type::operator[](_Base_type::size() - 3); } + { return _Unchecked::operator[](_Unchecked::size() - 3); } sub_match<_Bi_iter>& _M_unmatched_sub() - { return _Base_type::operator[](_Base_type::size() - 3); } + { return _Unchecked::operator[](_Unchecked::size() - 3); } const_reference _M_prefix() const - { return _Base_type::operator[](_Base_type::size() - 2); } + { return _Unchecked::operator[](_Unchecked::size() - 2); } sub_match<_Bi_iter>& _M_prefix() - { return _Base_type::operator[](_Base_type::size() - 2); } + { return _Unchecked::operator[](_Unchecked::size() - 2); } const_reference _M_suffix() const - { return _Base_type::operator[](_Base_type::size() - 1); } + { return _Unchecked::operator[](_Unchecked::size() - 1); } sub_match<_Bi_iter>& _M_suffix() - { return _Base_type::operator[](_Base_type::size() - 1); } + { return _Unchecked::operator[](_Unchecked::size() - 1); } _Bi_iter _M_begin; /// @endcond diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc index 39ad3f0a4cc2..c8bdd377c188 100644 --- a/libstdc++-v3/include/bits/regex.tcc +++ b/libstdc++-v3/include/bits/regex.tcc @@ -56,7 +56,7 @@ namespace __detail if (__re._M_automaton == nullptr) return false; - typename match_results<_BiIter, _Alloc>::_Base_type& __res = __m; + typename match_results<_BiIter, _Alloc>::_Unchecked& __res = __m; __m._M_begin = __s; __m._M_resize(__re._M_automaton->_M_sub_count()); @@ -66,7 +66,7 @@ namespace __detail && !__re._M_automaton->_M_has_backref)) { _Executor<_BiIter, _Alloc, _TraitsT, false> - __executor(__s, __e, __m, __re, __flags); + __executor(__s, __e, __res, __re, __flags); if (__match_mode) __ret = __executor._M_match(); else @@ -75,7 +75,7 @@ namespace __detail else { _Executor<_BiIter, _Alloc, _TraitsT, true> - __executor(__s, __e, __m, __re, __flags); + __executor(__s, __e, __res, __re, __flags); if (__match_mode) __ret = __executor._M_match(); else diff --git a/libstdc++-v3/include/bits/regex_automaton.tcc b/libstdc++-v3/include/bits/regex_automaton.tcc index 0977f7789228..69f3ee5ba3c5 100644 --- a/libstdc++-v3/include/bits/regex_automaton.tcc +++ b/libstdc++-v3/include/bits/regex_automaton.tcc @@ -194,8 +194,8 @@ namespace __detail _StateSeq<_TraitsT> _StateSeq<_TraitsT>::_M_clone() { - std::map<_StateIdT, _StateIdT> __m; - std::stack<_StateIdT> __stack; + _GLIBCXX_STD_C::map<_StateIdT, _StateIdT> __m; + std::stack<_StateIdT, _GLIBCXX_STD_C::deque<_StateIdT>> __stack; __stack.push(_M_start); while (!__stack.empty()) { diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h index bf7dcc54dba0..5b4f2ae35582 100644 --- a/libstdc++-v3/include/bits/regex_compiler.h +++ b/libstdc++-v3/include/bits/regex_compiler.h @@ -538,10 +538,10 @@ namespace __detail { } private: - std::vector<_CharT> _M_char_set; - std::vector<_StringT> _M_equiv_set; - std::vector> _M_range_set; - std::vector<_CharClassT> _M_neg_class_set; + _GLIBCXX_STD_C::vector<_CharT> _M_char_set; + _GLIBCXX_STD_C::vector<_StringT> _M_equiv_set; + _GLIBCXX_STD_C::vector> _M_range_set; + _GLIBCXX_STD_C::vector<_CharClassT> _M_neg_class_set; _CharClassT _M_class_set; _TransT _M_translator; const _TraitsT& _M_traits; diff --git a/libstdc++-v3/include/bits/regex_executor.h b/libstdc++-v3/include/bits/regex_executor.h index 014b4e830647..3422893371ac 100644 --- a/libstdc++-v3/include/bits/regex_executor.h +++ b/libstdc++-v3/include/bits/regex_executor.h @@ -60,7 +60,7 @@ namespace __detail public: typedef typename iterator_traits<_BiIter>::value_type _CharT; typedef basic_regex<_CharT, _TraitsT> _RegexT; - typedef std::vector, _Alloc> _ResultsVec; + typedef _GLIBCXX_STD_C::vector, _Alloc> _ResultsVec; typedef regex_constants::match_flag_type _FlagT; typedef typename _TraitsT::char_class_type _ClassT; typedef _NFA<_TraitsT> _NFAT; @@ -215,7 +215,7 @@ namespace __detail _BiIter* _M_get_sol_pos() { return nullptr; } // Saves states that need to be considered for the next character. - vector> _M_match_queue; + _GLIBCXX_STD_C::vector> _M_match_queue; // Indicates which states are already visited. bool* _M_visited_states; // To record current solution. @@ -248,7 +248,7 @@ namespace __detail const _RegexT& _M_re; const _NFAT& _M_nfa; _ResultsVec& _M_results; - vector> _M_rep_count; + _GLIBCXX_STD_C::vector> _M_rep_count; _State_info<__search_mode, _ResultsVec> _M_states; _FlagT _M_flags; // Do we have a solution so far? diff --git a/libstdc++-v3/include/std/regex b/libstdc++-v3/include/std/regex index 04fb8b2d9714..2c94fa306c29 100644 --- a/libstdc++-v3/include/std/regex +++ b/libstdc++-v3/include/std/regex @@ -55,6 +55,9 @@ #include #include #include +#ifdef _GLIBCXX_DEBUG +# include +#endif #include #include #include