diff options
Diffstat (limited to 'libstdc++-v3/include/bits/regex.h')
-rw-r--r-- | libstdc++-v3/include/bits/regex.h | 81 |
1 files changed, 47 insertions, 34 deletions
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 4d7e7d7..3420f10 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -32,6 +32,24 @@ namespace std _GLIBCXX_VISIBILITY(default) { _GLIBCXX_BEGIN_NAMESPACE_VERSION +namespace __detail +{ +_GLIBCXX_BEGIN_NAMESPACE_VERSION + + template<typename _BiIter, typename _Alloc, + typename _CharT, typename _TraitsT, + _RegexExecutorPolicy __policy, + bool __match_mode> + bool + __regex_algo_impl(_BiIter __s, + _BiIter __e, + match_results<_BiIter, _Alloc>& __m, + const basic_regex<_CharT, _TraitsT>& __re, + regex_constants::match_flag_type __flags); + +_GLIBCXX_END_NAMESPACE_VERSION +} + /** * @addtogroup regex * @{ @@ -713,7 +731,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _AutomatonPtr; template<typename _BiIter, typename _Alloc, - typename _CharT, typename _TraitsT> + typename _CharT, typename _TraitsT, + __detail::_RegexExecutorPolicy __policy> friend std::unique_ptr< __detail::_Executor<_BiIter, _Alloc, _CharT, _TraitsT>> __detail::__get_executor(_BiIter, @@ -722,19 +741,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const basic_regex<_CharT, _TraitsT>&, regex_constants::match_flag_type); - template<typename _Bp, typename _Ap, typename _Cp, typename _Rp> - friend bool - regex_match(_Bp, _Bp, - match_results<_Bp, _Ap>&, - const basic_regex<_Cp, _Rp>&, - regex_constants::match_flag_type); - - template<typename _Bp, typename _Ap, typename _Cp, typename _Rp> + template<typename _Bp, typename _Ap, typename _Cp, typename _Rp, + __detail::_RegexExecutorPolicy, bool> friend bool - regex_search(_Bp, _Bp, - match_results<_Bp, _Ap>&, - const basic_regex<_Cp, _Rp>&, - regex_constants::match_flag_type); + __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, + const basic_regex<_Cp, _Rp>&, + regex_constants::match_flag_type); template<typename, typename, typename, typename> friend class __detail::_Executor; @@ -1851,21 +1863,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename, typename, typename> friend class regex_iterator; - template<typename _Bp, typename _Ap, - typename _Ch_type, typename _Rx_traits> - friend bool - regex_match(_Bp, _Bp, match_results<_Bp, _Ap>&, - const basic_regex<_Ch_type, - _Rx_traits>&, - regex_constants::match_flag_type); - - template<typename _Bp, typename _Ap, - typename _Ch_type, typename _Rx_traits> + template<typename _Bp, typename _Ap, typename _Cp, typename _Rp, + __detail::_RegexExecutorPolicy, bool> friend bool - regex_search(_Bp, _Bp, match_results<_Bp, _Ap>&, - const basic_regex<_Ch_type, - _Rx_traits>&, - regex_constants::match_flag_type); + __detail::__regex_algo_impl(_Bp, _Bp, match_results<_Bp, _Ap>&, + const basic_regex<_Cp, _Rp>&, + regex_constants::match_flag_type); _Bi_iter _M_begin; bool _M_in_iterator; @@ -1951,13 +1954,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ template<typename _Bi_iter, typename _Alloc, typename _Ch_type, typename _Rx_traits> - bool + inline bool regex_match(_Bi_iter __s, _Bi_iter __e, match_results<_Bi_iter, _Alloc>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags - = regex_constants::match_default); + = regex_constants::match_default) + { + return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits, + __detail::_RegexExecutorPolicy::_S_auto, true> + (__s, __e, __m, __re, __flags); + } /** * @brief Indicates if there is a match between the regular expression @p e @@ -2091,12 +2099,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ template<typename _Bi_iter, typename _Alloc, typename _Ch_type, typename _Rx_traits> - bool - regex_search(_Bi_iter __first, _Bi_iter __last, + inline bool + regex_search(_Bi_iter __s, _Bi_iter __e, match_results<_Bi_iter, _Alloc>& __m, const basic_regex<_Ch_type, _Rx_traits>& __re, regex_constants::match_flag_type __flags - = regex_constants::match_default); + = regex_constants::match_default) + { + return __detail::__regex_algo_impl<_Bi_iter, _Alloc, _Ch_type, _Rx_traits, + __detail::_RegexExecutorPolicy::_S_auto, false> + (__s, __e, __m, __re, __flags); + } /** * Searches for a regular expression within a range. @@ -2586,8 +2599,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @param __rhs [IN] A %regex_token_iterator to copy. */ regex_token_iterator(const regex_token_iterator& __rhs) - : _M_position(__rhs.position), _M_subs(__rhs.subs), _M_n(__rhs.N), - _M_result(__rhs.result), _M_suffix(__rhs.suffix), + : _M_position(__rhs._M_position), _M_subs(__rhs._M_subs), + _M_n(__rhs._M_n), _M_result(__rhs._M_result), _M_suffix(__rhs._M_suffix), _M_has_m1(__rhs._M_has_m1) { if (__rhs._M_result == &__rhs._M_suffix) |