This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Support embedded zeros in sub_match comparisons (DR 2217)
- From: Daniel Krügler <daniel dot kruegler at gmail dot com>
- To: Tim Shen <timshen at google dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 13 Nov 2014 23:35:27 +0100
- Subject: Re: [patch] Support embedded zeros in sub_match comparisons (DR 2217)
- Authentication-results: sourceware.org; auth=none
- References: <CAGNvRgB+B1Ny2-a-uQ7+twie+C3J5mebzBaLV7YxdjMhymTfVw at mail dot gmail dot com> <CAG4ZjNnRMyOV1-E=XWFKhURbW8DTN7w+nS14Ho9J81TF4QiFDg at mail dot gmail dot com>
2014-11-13 23:30 GMT+01:00 Tim Shen <timshen@google.com>:
> On Thu, Nov 13, 2014 at 2:11 PM, Daniel Krügler
> <daniel.kruegler@gmail.com> wrote:
>> + typedef typename sub_match<_Bi_iter>::string_type string_type;
>
> Use _String_type instead of string_type? I'm not 100% sure of this.
I thought about this first, but withdraw that for two reasons: The
name string_type is not protected (it is an official typedef of
sub_match) and we use exactly the same approach elsewhere, e.g. see
around line 1318, 1346, 1398, 1426:
template<typename _Bi_iter>
inline bool
operator==(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
const sub_match<_Bi_iter>& __rhs)
{
typedef typename sub_match<_Bi_iter>::string_type string_type;
return __rhs.compare(string_type(1, __lhs)) == 0;
}
So I followed for consistency reasons.
- Daniel