Patchwork [3/4] std::regex refactoring

login
register
mail settings
Submitter Jonathan Wakely
Date Nov. 8, 2013, 2:31 p.m.
Message ID <CAH6eHdTERFgP3rN5yJ9NdJ-_DpxrJOZCv=N16mTMzuHrz=1tgA@mail.gmail.com>
Download mbox | patch
Permalink /patch/289847/
State New
Headers show

Comments

Jonathan Wakely - Nov. 8, 2013, 2:31 p.m.
This removes some more redundant _CharT template parameters.

2013-11-08  Jonathan Wakely  <jwakely.gcc@gmail.com>

        * include/bits/regex_compiler.h (__detail::_AnyMatcher,
        __detail::_CharMatcher, __detail::_BracketMatcher): Remove redundant
        _CharT template parameters.
        * include/bits/regex_compiler.tcc: Likewise.

Tested x86_64-linux, committed to trunk.
commit 1202237bdd397d1d3104bf1125e72f16d443d134
Author: Jonathan Wakely <jwakely.gcc@gmail.com>
Date:   Fri Nov 8 12:45:26 2013 +0000

    	* include/bits/regex_compiler.h (__detail::_AnyMatcher,
    	__detail::_CharMatcher, __detail::_BracketMatcher): Remove redundant
    	_CharT template parameters.
    	* include/bits/regex_compiler.tcc: Likewise.

Patch

diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h
index fef8862..406d9a9 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -39,7 +39,7 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
    * @{
    */
 
-  template<typename _CharT, typename _TraitsT>
+  template<typename _TraitsT>
     struct _BracketMatcher;
 
   /// Builds an NFA from an input iterator interval.
@@ -59,13 +59,12 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       { return make_shared<_RegexT>(std::move(_M_nfa)); }
 
     private:
-      typedef typename _TraitsT::char_type		      _CharT;
       typedef _Scanner<_FwdIter>                              _ScannerT;
       typedef typename _ScannerT::_TokenT                     _TokenT;
       typedef _StateSeq<_TraitsT>                     	      _StateSeqT;
       typedef std::stack<_StateSeqT, std::vector<_StateSeqT>> _StackT;
-      typedef _BracketMatcher<_CharT, _TraitsT>               _BMatcherT;
-      typedef std::ctype<_CharT>                              _CtypeT;
+      typedef _BracketMatcher<_TraitsT>			      _BMatcherT;
+      typedef std::ctype<typename _TraitsT::char_type>        _CtypeT;
 
       // accepts a specific token or returns false.
       bool
@@ -139,9 +138,11 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return _Cmplr(__first, __last, __traits, __flags)._M_get_nfa();
     }
 
-  template<typename _CharT, typename _TraitsT>
+  template<typename _TraitsT>
     struct _AnyMatcher
     {
+      typedef typename _TraitsT::char_type	  _CharT;
+
       explicit
       _AnyMatcher(const _TraitsT& __traits)
       : _M_traits(__traits)
@@ -159,9 +160,10 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       const _TraitsT& _M_traits;
     };
 
-  template<typename _CharT, typename _TraitsT>
+  template<typename _TraitsT>
     struct _CharMatcher
     {
+      typedef typename _TraitsT::char_type	  _CharT;
       typedef regex_constants::syntax_option_type _FlagT;
 
       explicit
@@ -188,9 +190,10 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
     };
 
   /// Matches a character range (bracket expression)
-  template<typename _CharT, typename _TraitsT>
+  template<typename _TraitsT>
     struct _BracketMatcher
     {
+      typedef typename _TraitsT::char_type	  _CharT;
       typedef typename _TraitsT::char_class_type  _CharClassT;
       typedef typename _TraitsT::string_type      _StringT;
       typedef regex_constants::syntax_option_type _FlagT;
diff --git a/libstdc++-v3/include/bits/regex_compiler.tcc b/libstdc++-v3/include/bits/regex_compiler.tcc
index 49c32b8..f89498f 100644
--- a/libstdc++-v3/include/bits/regex_compiler.tcc
+++ b/libstdc++-v3/include/bits/regex_compiler.tcc
@@ -286,11 +286,11 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       if (_M_match_token(_ScannerT::_S_token_anychar))
 	_M_stack.push(_StateSeqT(_M_nfa,
 				_M_nfa._M_insert_matcher
-				(_AnyMatcher<_CharT, _TraitsT>(_M_traits))));
+				(_AnyMatcher<_TraitsT>(_M_traits))));
       else if (_M_try_char())
 	_M_stack.push(_StateSeqT(_M_nfa,
 				 _M_nfa._M_insert_matcher
-				 (_CharMatcher<_CharT, _TraitsT>(_M_value[0],
+				 (_CharMatcher<_TraitsT>(_M_value[0],
 								 _M_traits,
 								 _M_flags))));
       else if (_M_match_token(_ScannerT::_S_token_backref))
@@ -430,9 +430,9 @@  _GLIBCXX_BEGIN_NAMESPACE_VERSION
       return __v;
     }
 
-  template<typename _CharT, typename _TraitsT>
+  template<typename _TraitsT>
     bool
-    _BracketMatcher<_CharT, _TraitsT>::operator()(_CharT __ch) const
+    _BracketMatcher<_TraitsT>::operator()(_CharT __ch) const
     {
       bool __ret = false;
       if (_M_traits.isctype(__ch, _M_class_set)