diff options
author | Tim Shen <timshen91@gmail.com> | 2014-01-16 23:35:21 +0000 |
---|---|---|
committer | Tim Shen <timshen@gcc.gnu.org> | 2014-01-16 23:35:21 +0000 |
commit | ddf41e9db6f43e3fdb0f2717fb47851a2a64d5bc (patch) | |
tree | d4af0e8eec13c68aaeba7d1ccacd8f8508d5064f /libstdc++-v3/include/bits/regex.h | |
parent | 9e6f9ad62c66546ac8b475521e840c9661b6fa78 (diff) | |
download | gcc-ddf41e9db6f43e3fdb0f2717fb47851a2a64d5bc.zip gcc-ddf41e9db6f43e3fdb0f2717fb47851a2a64d5bc.tar.gz gcc-ddf41e9db6f43e3fdb0f2717fb47851a2a64d5bc.tar.bz2 |
regex_automaton.tcc (_StateSeq<>::_M_clone()): Do not use std::map.
2014-01-17 Tim Shen <timshen91@gmail.com>
* include/bits/regex_automaton.tcc (_StateSeq<>::_M_clone()): Do not
use std::map.
* include/bits/regex_automaton.h: Do not use std::set.
* include/bits/regex_compiler.h (_BracketMatcher<>::_M_add_char(),
_BracketMatcher<>::_M_add_collating_element(),
_BracketMatcher<>::_M_add_equivalence_class(),
_BracketMatcher<>::_M_make_range()): Likewise.
* include/bits/regex_compiler.tcc (_BracketMatcher<>::_M_apply()):
Likewise.
* include/bits/regex_executor.h: Do not use std::queue.
* include/bits/regex_executor.tcc (_Executor<>::_M_main(),
_Executor<>::_M_dfs()): Likewise.
* include/std/regex: Remove <map>, <set> and <queue>.
2014-01-17 Tim Shen <timshen91@gmail.com>
* include/bits/regex.h (__compile_nfa<>(), basic_regex<>::basic_regex(),
basic_regex<>::assign()): Change __compile_nfa to accept
const _CharT* only.
* include/bits/regex_compiler.h: Change _Compiler's template
argument from <_FwdIter, _TraitsT> to <_TraitsT>.
* include/bits/regex_compiler.tcc: Likewise.
2014-01-17 Tim Shen <timshen91@gmail.com>
* include/bits/regex_compiler.h: Change _ScannerT into char-type
templated.
* include/bits/regex_scanner.h (_Scanner<>::_Scanner()): Separate
_ScannerBase from _Scanner; Change _Scanner's template argument from
_FwdIter to _CharT. Avoid use of std::map and std::set by using arrays
instead.
* include/bits/regex_scanner.tcc (_Scanner<>::_Scanner(),
_Scanner<>::_M_scan_normal(), _Scanner<>::_M_eat_escape_ecma(),
_Scanner<>::_M_eat_escape_posix(), _Scanner<>::_M_eat_escape_awk()):
Likewise.
* include/std/regex: Add <cstring> for using strchr.
2014-01-17 Tim Shen <timshen91@gmail.com>
* bits/regex_automaton.tcc: Indentation fix.
* bits/regex_compiler.h (__compile_nfa<>(), _Compiler<>,
_RegexTranslator<> _AnyMatcher<>, _CharMatcher<>,
_BracketMatcher<>): Add bool option template parameters and
specializations to make matching more efficient and space saving.
* bits/regex_compiler.tcc: Likewise.
From-SVN: r206690
Diffstat (limited to 'libstdc++-v3/include/bits/regex.h')
-rw-r--r-- | libstdc++-v3/include/bits/regex.h | 59 |
1 files changed, 12 insertions, 47 deletions
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index ae8e1f5..816f5cf 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -60,51 +60,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template<typename, typename, typename, bool> class _Executor; - template<typename _Tp> - struct __has_contiguous_iter : std::false_type { }; - - template<typename _Ch, typename _Tr, typename _Alloc> - struct __has_contiguous_iter<std::basic_string<_Ch, _Tr, _Alloc>> - : std::true_type // string<Ch> storage is contiguous - { }; - - template<typename _Tp, typename _Alloc> - struct __has_contiguous_iter<std::vector<_Tp, _Alloc>> - : std::true_type // vector<Tp> storage is contiguous - { }; - - template<typename _Alloc> - struct __has_contiguous_iter<std::vector<bool, _Alloc>> - : std::false_type // vector<bool> storage is not contiguous - { }; - - template<typename _Tp> - struct __is_contiguous_normal_iter : std::false_type { }; - - template<typename _Tp, typename _Cont> - struct - __is_contiguous_normal_iter<__gnu_cxx::__normal_iterator<_Tp, _Cont>> - : __has_contiguous_iter<_Cont>::type - { }; - - template<typename _Iter, typename _TraitsT> - using __enable_if_contiguous_normal_iter - = typename enable_if< __is_contiguous_normal_iter<_Iter>::value, - std::shared_ptr<_NFA<_TraitsT>> >::type; - - template<typename _Iter, typename _TraitsT> - using __disable_if_contiguous_normal_iter - = typename enable_if< !__is_contiguous_normal_iter<_Iter>::value, - std::shared_ptr<_NFA<_TraitsT>> >::type; - - template<typename _FwdIter, typename _TraitsT> - __disable_if_contiguous_normal_iter<_FwdIter, _TraitsT> - __compile_nfa(_FwdIter __first, _FwdIter __last, const _TraitsT& __traits, - regex_constants::syntax_option_type __flags); - - template<typename _Iter, typename _TraitsT> - __enable_if_contiguous_normal_iter<_Iter, _TraitsT> - __compile_nfa(_Iter __first, _Iter __last, const _TraitsT& __traits, + template<typename _TraitsT> + inline std::shared_ptr<_NFA<_TraitsT>> + __compile_nfa(const typename _TraitsT::char_type* __first, + const typename _TraitsT::char_type* __last, + const _TraitsT& __traits, regex_constants::syntax_option_type __flags); _GLIBCXX_END_NAMESPACE_VERSION @@ -561,7 +521,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION flag_type __f = ECMAScript) : _M_flags(__f), _M_original_str(__first, __last), - _M_automaton(__detail::__compile_nfa(__first, __last, _M_traits, + _M_automaton(__detail::__compile_nfa(_M_original_str.c_str(), + _M_original_str.c_str() + + _M_original_str.size(), + _M_traits, _M_flags)) { } @@ -698,7 +661,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { _M_flags = __flags; _M_original_str.assign(__s.begin(), __s.end()); - _M_automaton = __detail::__compile_nfa(__s.begin(), __s.end(), + auto __p = _M_original_str.c_str(); + _M_automaton = __detail::__compile_nfa(__p, + __p + _M_original_str.size(), _M_traits, _M_flags); return *this; } |