libstdc++: Remove obfuscating typedefs in <regex>
authorJonathan Wakely <jwakely@redhat.com>
Tue, 28 Sep 2021 12:39:36 +0000 (13:39 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 28 Sep 2021 19:38:58 +0000 (20:38 +0100)
There is no benefit to using _SizeT instead of size_t, and IterT tells
you less about the type than const _CharT*. This removes some unhelpful
typedefs.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/bits/regex_automaton.h (_NFA_base::_SizeT): Remove.
* include/bits/regex_compiler.h (_Compiler::_IterT): Remove.
* include/bits/regex_compiler.tcc: Likewise.
* include/bits/regex_scanner.h (_Scanner::_IterT): Remove.
* include/bits/regex_scanner.tcc: Likewise.

libstdc++-v3/include/bits/regex_automaton.h
libstdc++-v3/include/bits/regex_compiler.h
libstdc++-v3/include/bits/regex_compiler.tcc
libstdc++-v3/include/bits/regex_scanner.h
libstdc++-v3/include/bits/regex_scanner.tcc

index 02d81f3..f108675 100644 (file)
@@ -183,7 +183,6 @@ namespace __detail
 
   struct _NFA_base
   {
-    typedef size_t                              _SizeT;
     typedef regex_constants::syntax_option_type _FlagT;
 
     explicit
@@ -206,14 +205,14 @@ namespace __detail
     _M_start() const noexcept
     { return _M_start_state; }
 
-    _SizeT
+    size_t
     _M_sub_count() const noexcept
     { return _M_subexpr_count; }
 
     _GLIBCXX_STD_C::vector<size_t> _M_paren_stack;
     _FlagT                    _M_flags;
     _StateIdT                 _M_start_state;
-    _SizeT                    _M_subexpr_count;
+    size_t                    _M_subexpr_count;
     bool                      _M_has_backref;
   };
 
index 423ab82..646766e 100644 (file)
@@ -58,11 +58,10 @@ namespace __detail
     {
     public:
       typedef typename _TraitsT::char_type        _CharT;
-      typedef const _CharT*                       _IterT;
       typedef _NFA<_TraitsT>                     _RegexT;
       typedef regex_constants::syntax_option_type _FlagT;
 
-      _Compiler(_IterT __b, _IterT __e,
+      _Compiler(const _CharT* __b, const _CharT* __e,
                const typename _TraitsT::locale_type& __traits, _FlagT __flags);
 
       shared_ptr<const _RegexT>
index 9f04c1b..1bd3097 100644 (file)
@@ -63,7 +63,7 @@ namespace __detail
 {
   template<typename _TraitsT>
     _Compiler<_TraitsT>::
-    _Compiler(_IterT __b, _IterT __e,
+    _Compiler(const _CharT* __b, const _CharT* __e,
              const typename _TraitsT::locale_type& __loc, _FlagT __flags)
     : _M_flags((__flags
                & (regex_constants::ECMAScript
index 05d8172..4e7d5ef 100644 (file)
@@ -211,12 +211,11 @@ namespace __detail
     : public _ScannerBase
     {
     public:
-      typedef const _CharT*                                       _IterT;
       typedef std::basic_string<_CharT>                           _StringT;
       typedef regex_constants::syntax_option_type                 _FlagT;
       typedef const std::ctype<_CharT>                            _CtypeT;
 
-      _Scanner(_IterT __begin, _IterT __end,
+      _Scanner(const _CharT* __begin, const _CharT* __end,
               _FlagT __flags, std::locale __loc);
 
       void
@@ -257,8 +256,8 @@ namespace __detail
       void
       _M_eat_class(char);
 
-      _IterT                        _M_current;
-      _IterT                        _M_end;
+      const _CharT*                 _M_current;
+      const _CharT*                 _M_end;
       _CtypeT&                      _M_ctype;
       _StringT                      _M_value;
       void (_Scanner::* _M_eat_escape)();
index a9d6a61..b2b709c 100644 (file)
@@ -54,8 +54,7 @@ namespace __detail
 {
   template<typename _CharT>
     _Scanner<_CharT>::
-    _Scanner(typename _Scanner::_IterT __begin,
-            typename _Scanner::_IterT __end,
+    _Scanner(const _CharT* __begin, const _CharT* __end,
             _FlagT __flags, std::locale __loc)
     : _ScannerBase(__flags),
       _M_current(__begin), _M_end(__end),