C++ Logo

sg16

Advanced search

Re: [SG16-Unicode] Replacement for codecvt

From: Lyberta <lyberta_at_[hidden]>
Date: Thu, 29 Aug 2019 11:18:00 +0000
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.


Received on 2019-08-29 13:18:51