C++ Logo

std-proposals

Advanced search

Re: [std-proposals] constexpr tolower, toupper, isalpha

From: Thiago Macieira <thiago_at_[hidden]>
Date: Wed, 09 Jul 2025 08:26:37 -0700
On Wednesday, 9 July 2025 07:51:53 Pacific Daylight Time Jason McKesson via
Std-Proposals wrote:
> Indeed, I'm not sure that any Unicode processing *needs* to be
> `constexpr` even if it could be. Maybe if you're using `#embed` to
> include a UTF-8 file as a byte sequence and need to do some Unicode
> processing on it to generate some static array?

The one thing that comes to mind is converting UTF-8 input to UTF-16 or 32
after #embed.

Normalising, case-folding, could come in handy if you're trying to store a
dictionary for example (in the original meaning of "dictionary") so that look
ups of equivalent inputs only need to normalise the user's runtime content.
But this quickly degenerates into needing to create a hashing table, then a
perfect hashing function, for which I think a proper generator is more
indicated. Then you don't need #embed in the first place.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel Platform & System Engineering

Received on 2025-07-09 15:26:41