]> gcc.gnu.org Git - gcc.git/commitdiff
locale_facets.tcc (num_get<>::_M_extract_float, [...]): Prefer plain operator== to...
authorPaolo Carlini <pcarlini@suse.de>
Sat, 6 Mar 2004 09:00:14 +0000 (09:00 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Sat, 6 Mar 2004 09:00:14 +0000 (09:00 +0000)
2004-03-06  Paolo Carlini  <pcarlini@suse.de>

* include/bits/locale_facets.tcc (num_get<>::_M_extract_float,
num_get<>::_M_extract_int, num_get<>::do_get(bool&),
__pad<>::_S_pad): Prefer plain operator== to traits::eq().
* testsuite/testsuite_character.h (struct __gnu_test::character):
Provide operator==.
* testsuite/testsuite_hooks.h (struct __gnu_test::pod_char):
Likewise.

From-SVN: r79011

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/locale_facets.tcc
libstdc++-v3/testsuite/testsuite_character.h
libstdc++-v3/testsuite/testsuite_hooks.h

index 820ae5ecf7a7f6cd64a0d6389d2c503fb1cf07a8..ef11a7ff21b50dda31969586626fd16cf3049161 100644 (file)
@@ -1,3 +1,13 @@
+2004-03-06  Paolo Carlini  <pcarlini@suse.de>
+
+       * include/bits/locale_facets.tcc (num_get<>::_M_extract_float,
+       num_get<>::_M_extract_int, num_get<>::do_get(bool&),
+       __pad<>::_S_pad): Prefer plain operator== to traits::eq().
+       * testsuite/testsuite_character.h (struct __gnu_test::character):
+       Provide operator==.
+       * testsuite/testsuite_hooks.h (struct __gnu_test::pod_char):
+       Likewise.
+
 2004-03-05  Paolo Carlini  <pcarlini@suse.de>
 
        * testsuite/27_io/fpos/14320-2.cc: Remove xfail.
index 997308f61190285a2780ac883e6a8f8aed98115d..705a11f769ebb8b7367bf561ebbe66189988d095 100644 (file)
@@ -182,11 +182,10 @@ namespace std
       if (__beg != __end)
        {
          const char_type __c = *__beg;
-         const bool __plus = __traits_type::eq(__c, __lit[_S_iplus]);
-         if ((__plus || __traits_type::eq(__c, __lit[_S_iminus]))
-             && (!__lc->_M_use_grouping
-                 || !__traits_type::eq(__c, __lc->_M_thousands_sep))
-             && !__traits_type::eq(__c, __lc->_M_decimal_point))
+         const bool __plus = __c == __lit[_S_iplus];
+         if ((__plus || __c == __lit[_S_iminus])
+             && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
+             && !(__c == __lc->_M_decimal_point))
            {
              __xtrc += __plus ? '+' : '-';
              ++__beg;
@@ -197,11 +196,10 @@ namespace std
       while (__beg != __end)
        {
          const char_type __c = *__beg;
-         if (__lc->_M_use_grouping
-             && __traits_type::eq(__c, __lc->_M_thousands_sep)
-             || __traits_type::eq(__c, __lc->_M_decimal_point))
+         if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep
+             || __c == __lc->_M_decimal_point)
            break;
-         else if (__traits_type::eq(__c, __lit[_S_izero]))
+         else if (__c == __lit[_S_izero])
            {
              if (!__found_mantissa)
                {
@@ -228,8 +226,7 @@ namespace std
          // According to 22.2.2.1.2, p8-9, first look for thousands_sep
          // and decimal_point.
          const char_type __c = *__beg;
-          if (__lc->_M_use_grouping
-             && __traits_type::eq(__c, __lc->_M_thousands_sep))
+          if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
            {
              if (!__found_dec && !__found_sci)
                {
@@ -250,7 +247,7 @@ namespace std
              else
                break;
             }
-         else if (__traits_type::eq(__c, __lc->_M_decimal_point))
+         else if (__c == __lc->_M_decimal_point)
            {
              if (!__found_dec && !__found_sci)
                {
@@ -273,8 +270,7 @@ namespace std
              ++__sep_pos;
              ++__beg;
            }
-         else if ((__traits_type::eq(__c, __lit[_S_ie])
-                   || __traits_type::eq(__c, __lit[_S_iE]))
+         else if ((__c == __lit[_S_ie] || __c == __lit[_S_iE])
                   && __found_mantissa && !__found_sci)
            {
              // Scientific notation.
@@ -286,12 +282,11 @@ namespace std
              // Remove optional plus or minus sign, if they exist.
              if (++__beg != __end)
                {
-                 const bool __plus = __traits_type::eq(*__beg,
-                                                       __lit[_S_iplus]);
-                 if ((__plus || __traits_type::eq(*__beg, __lit[_S_iminus]))
-                     && (!__lc->_M_use_grouping
-                         || !__traits_type::eq(*__beg, __lc->_M_thousands_sep))
-                     && !__traits_type::eq(*__beg, __lc->_M_decimal_point))
+                 const bool __plus = *__beg == __lit[_S_iplus];
+                 if ((__plus || *__beg == __lit[_S_iminus])
+                     && !(__lc->_M_use_grouping
+                          && *__beg == __lc->_M_thousands_sep)
+                     && !(*__beg == __lc->_M_decimal_point))
                    {
                      __xtrc += __plus ? '+' : '-';
                      ++__beg;
@@ -351,11 +346,10 @@ namespace std
          {
            const char_type __c = *__beg;
            if (numeric_limits<_ValueT>::is_signed)
-             __negative = __traits_type::eq(__c, __lit[_S_iminus]);
-           if ((__negative || __traits_type::eq(__c, __lit[_S_iplus]))
-               && (!__lc->_M_use_grouping
-                   || !__traits_type::eq(__c, __lc->_M_thousands_sep))
-               && !__traits_type::eq(__c, __lc->_M_decimal_point))
+             __negative = __c == __lit[_S_iminus];
+           if ((__negative || __c == __lit[_S_iplus])
+               && !(__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
+               && !(__c == __lc->_M_decimal_point))
              ++__beg;
          }
 
@@ -364,20 +358,17 @@ namespace std
        while (__beg != __end)
          {
            const char_type __c = *__beg;
-           if (__lc->_M_use_grouping
-               && __traits_type::eq(__c, __lc->_M_thousands_sep)
-               || __traits_type::eq(__c, __lc->_M_decimal_point))
+           if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep
+               || __c == __lc->_M_decimal_point)
              break;
-           else if (__traits_type::eq(__c, __lit[_S_izero])
-                    && (!__found_num || __base == 10))
+           else if (__c == __lit[_S_izero] && (!__found_num || __base == 10))
              {
                __found_num = true;
                ++__beg;
              }
            else if (__found_num)
              {
-               if (__traits_type::eq(__c, __lit[_S_ix])
-                   || __traits_type::eq(__c, __lit[_S_iX]))
+               if (__c == __lit[_S_ix] || __c == __lit[_S_iX])
                  {
                    if (__basefield == 0)
                      __base = 16;
@@ -416,8 +407,7 @@ namespace std
                // According to 22.2.2.1.2, p8-9, first look for thousands_sep
                // and decimal_point.
                const char_type __c = *__beg;
-               if (__lc->_M_use_grouping
-                   && __traits_type::eq(__c, __lc->_M_thousands_sep))
+               if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
                  {
                    // NB: Thousands separator at the beginning of a string
                    // is a no-no, as is two consecutive thousands separators.
@@ -432,7 +422,7 @@ namespace std
                        break;
                      }
                  }
-               else if (__traits_type::eq(__c, __lc->_M_decimal_point))
+               else if (__c == __lc->_M_decimal_point)
                  break;
                else if (__q = __traits_type::find(__lit_zero, __len, __c))
                  {
@@ -462,8 +452,7 @@ namespace std
            for (; __beg != __end; ++__beg)
              {
                const char_type __c = *__beg;
-               if (__lc->_M_use_grouping
-                   && __traits_type::eq(__c, __lc->_M_thousands_sep))
+               if (__lc->_M_use_grouping && __c == __lc->_M_thousands_sep)
                  {
                    if (__sep_pos)
                      {
@@ -476,7 +465,7 @@ namespace std
                        break;
                      }
                  }
-               else if (__traits_type::eq(__c, __lc->_M_decimal_point))
+               else if (__c == __lc->_M_decimal_point)
                  break;
                else if (__q = __traits_type::find(__lit_zero, __len, __c))
                  {
@@ -560,13 +549,13 @@ namespace std
             {
              if (__testf)
                if (__n < __lc->_M_falsename_size)
-                 __testf = __traits_type::eq(*__beg, __lc->_M_falsename[__n]);
+                 __testf = *__beg == __lc->_M_falsename[__n];
                else
                  break;
 
              if (__testt)
                if (__n < __lc->_M_truename_size)
-                 __testt = __traits_type::eq(*__beg, __lc->_M_truename[__n]);
+                 __testt = *__beg == __lc->_M_truename[__n];
                else
                  break;
 
@@ -2330,13 +2319,12 @@ namespace std
           const locale& __loc = __io._M_getloc();
          const ctype<_CharT>& __ctype = use_facet<ctype<_CharT> >(__loc);
 
-         const bool __testsign = _Traits::eq(__ctype.widen('-'), __olds[0])
-                                 || _Traits::eq(__ctype.widen('+'), __olds[0]);
-         const bool __testhex = (_Traits::eq(__ctype.widen('0'), __olds[0])
+         const bool __testsign = (__ctype.widen('-') == __olds[0]
+                                  || __ctype.widen('+') == __olds[0]);
+         const bool __testhex = (__ctype.widen('0') == __olds[0]
                                  && __oldlen > 1
-                                 && (_Traits::eq(__ctype.widen('x'), __olds[1])
-                                     || _Traits::eq(__ctype.widen('X'),
-                                                    __olds[1])));
+                                 && (__ctype.widen('x') == __olds[1]
+                                     || __ctype.widen('X') == __olds[1]));
          if (__testhex)
            {
              __news[0] = __olds[0];
index 67c35c25443637f75aef51277384a43e3bf985f7..9442fe13341e6a9b4bfd10ab065d7a4df3e91466 100644 (file)
@@ -51,6 +51,10 @@ namespace __gnu_test
     }
   };
 
+  inline bool
+  operator==(const character& lhs, const character& rhs)
+  { return lhs.val == rhs.val; }
+
   // State type.
   struct conversion_state
   {
index efe0f85eaa104859857ec3be2c2edef50d0ff86c..e36162ad23b077c16b46e3a6bb87a9857f0a7a08 100644 (file)
@@ -152,6 +152,10 @@ namespace __gnu_test
   {
     unsigned char c;
   };
+
+  inline bool
+  operator==(const pod_char& lhs, const pod_char& rhs)
+  { return lhs.c == rhs.c; }
   
   struct pod_int
   {
This page took 0.073654 seconds and 5 git commands to generate.