[SG16-Unicode] Replacement for codecvt

Lyberta lyberta at lyberta.net
Thu Aug 29 13:18:00 CEST 2019


Niall Douglas:
> As SG16 knows, I've been busy reworking path_view to meet your feedback.
> I am finding std::codecvt to be a steaming pile of poo, and I was
> wondering if anyone on SG16 plans to propose a more usable, modern,
> Unicode library API?

Yes, of course. I just need ranges so I can test and write a wording for
my proposal for encoding forms API.

It has the following static member functions:

to_scalar_value taking std::input_range and returning
std::unicode::scalar_value.

to_code_units taking std::unicode::scalar_value and std::output_range,
returning nothing.

next_scalar_value taking std::input_range and mutating it, returning
nothing.

previous_scalar_value taking std::bidirectional_range and mutating it,
returning nothing.

These are enough to implement conversions between various UTF and to
implement std::unicode::scalar_value_sequence.

std::unicode::scalar_value_sequence has iterators that call those
encoding forms:

operator* returns magic reference that calls to_scalar_value
operator= to returned magic reference calls to_code_units
operator++ calls next_scalar_value
operator-- calls previous_scalar_value

As the proposal is targeting C++23, I'm sure we get ranges so the
wording should be finished in time.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
Url : http://www.open-std.org/pipermail/unicode/attachments/20190829/e83fd820/attachment.bin 


More information about the Unicode mailing list