[patch] LWG 2019 - std::isblank<C>(C, const std::locale&)
Jonathan Wakely
jwakely@redhat.com
Tue Oct 21 12:26:00 GMT 2014
On 20/10/14 23:08 +0100, Jonathan Wakely wrote:
>On 20 October 2014 18:40, Tim Shen <timshen@google.com> wrote:
>> On Mon, Oct 20, 2014 at 5:34 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
>>> Committed to trunk.
>>
>> Yay, I think it's the time to remove regex_traits::_RegexMask?
>
>Yes, I wanted to get isblank in first, and see how many targets I
>broke, then revisit regex.
I don't think we can remove _RegexMask entirely, as we still need
special handling for the "w" class, so maybe something like the
attached.
Alternatively we could replace _M_extended with bool _M_under and not
need to do any bitwise operations like _M_extended & _S_valid_mask.
-------------- next part --------------
diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 4244f2e..30189e3 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -97,14 +97,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
private:
struct _RegexMask
{
- typedef typename std::ctype<char_type>::mask _BaseType;
+ typedef std::ctype_base::mask _BaseType;
_BaseType _M_base;
unsigned char _M_extended;
static constexpr unsigned char _S_under = 1 << 0;
- // FIXME: _S_blank should be removed in the future,
- // when locale's complete.
- static constexpr unsigned char _S_blank = 1 << 1;
- static constexpr unsigned char _S_valid_mask = 0x3;
+ static constexpr unsigned char _S_valid_mask = 0x1;
constexpr _RegexMask(_BaseType __base = 0,
unsigned char __extended = 0)
diff --git a/libstdc++-v3/include/bits/regex.tcc b/libstdc++-v3/include/bits/regex.tcc
index 3322379..94cbbfa 100644
--- a/libstdc++-v3/include/bits/regex.tcc
+++ b/libstdc++-v3/include/bits/regex.tcc
@@ -335,7 +335,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{"s", ctype_base::space},
{"alnum", ctype_base::alnum},
{"alpha", ctype_base::alpha},
- {"blank", {0, _RegexMask::_S_blank}},
+ {"blank", ctype_base::blank},
{"cntrl", ctype_base::cntrl},
{"digit", ctype_base::digit},
{"graph", ctype_base::graph},
@@ -377,11 +377,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
return __fctyp.is(__f._M_base, __c)
// [[:w:]]
|| ((__f._M_extended & _RegexMask::_S_under)
- && __c == __fctyp.widen('_'))
- // [[:blank:]]
- || ((__f._M_extended & _RegexMask::_S_blank)
- && (__c == __fctyp.widen(' ')
- || __c == __fctyp.widen('\t')));
+ && __c == __fctyp.widen('_'));
}
template<typename _Ch_type>
More information about the Libstdc++
mailing list