Subject: Re: [boost] [Convert] std::isspace requires unsigned #28
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2017-03-21 00:43:03
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
> 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.
And as Glen suggests, simple overloads seem tidier.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk