C++ Logo

sg16

Advanced search

Re: [SG16-Unicode] code_unit_sequence and code_point_sequence

From: Lyberta <lyberta_at_[hidden]>
Date: Tue, 19 Jun 2018 12:40:00 +0000
Martinho Fernandes:
> But this just makes the example convince me that code_unit_sequence is
> even less useful. If I understood correctly you wanted to show that
> supporting utf32be in code_point_sequence makes things more complicated
> for the user. Correct me if my understanding of the interface is wrong,
> but, roughly, I don't think I can be convinced that:
>
> code_unit_sequence<utf16, big_endian> cus(std::move(source));
> code_point_sequence<utf16> cps(std::move(cus));

code_point_sequence takes container as the first parameter so the second
line of code will be just:

code_point_sequence cps(std::move(cus));

We can provide deduction guide, for example:

code_point_sequence sps{u"Hello"};

Would deduce to:

code_point_sequence<code_unit_sequence<utf16, std::endian::native,
    std::allocator<std::byte>>>

Remember there are tons of code unit sequence types out there:
std::basic_string, Microsoft's CString, Qt's QString, wxWidgets's
wxString. We want to support all those types if people provide their
encoding form traits.


Received on 2018-06-19 14:40:27