|
Boost : |
Subject: Re: [boost] [Convert] std::isspace requires unsigned #28
From: Vladimir Batov (Vladimir.Batov_at_[hidden])
Date: 2017-03-21 00:46:05
On 2017-03-21 11:43, Gavin Lambert via Boost wrote:
> On 21/03/2017 13:16, Vladimir Batov via Boost wrote:
>> Damn confused.
>>
>> WAS: std::isspace(ch);
>> THEN: std::isspace(static_cast<unsigned char>(ch));
>>
>> THEN I realized I needed wchar_t support and therefore needed also
>> std::iswspace(). So, for such a seemingly trivial thing I ended up
>> with
>> the following ugliness:
> [...]
>> That raises two questions.
>>
>> 1) Is it really the only way to go or I went senile or fell behind
>> language-wise?
>> 2) What about std::iswspace? Does it also need static_cast?
>>
>> Apologies for seemingly naive questions but I really feel startled.
>
> I haven't verified but presumably
> std::char_traits<char/wchar_t>::to_int_type() would convert correctly
> for input to std::isspace/iswspace.
Thanks, Gavin, indeed I should have a dig in char_traits before
re-inventing the wheel. Thanks.
What about iswspace()? Does it have the same problem as std::isspace(),
i.e. needs an explicit cast? Seems unlikely...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk