On 21/03/2017 13:46, Vladimir Batov via Boost wrote:
Thanks, Gavin, indeed I should have a dig in char_traits before re-inventing the wheel. Thanks.
There's also std::ctype
What about iswspace()? Does it have the same problem as std::isspace(), i.e. needs an explicit cast? Seems unlikely...
I think it's probably good practice to use char_traits<>::to_int_type() for that too, since the parameter type is wint_t rather than wchar_t, and that's the "right" way to do that conversion. As Peter said in practice it probably wouldn't cause any bugs without that since it would be weird for wchar_t to be signed, but as both the sign and size of the type is implementation-defined it's not actually illegal for that to be the case. (And you're even less likely to notice on platforms where wchar_t is 32-bit or larger, but again that's implementation-defined.)