C++ Logo

sg16

Advanced search

Re: [SG16-Unicode] Need a char8_t implementation for filesystem::path_view

From: Tom Honermann <tom_at_[hidden]>
Date: Wed, 31 Jul 2019 12:21:20 -0400
On 7/31/19 4:27 AM, Niall Douglas wrote:
> Just fixing up path_view with the feedback from SG16 and LEWG right now.
>
> Does anybody have to hand a char8_t implementation for C++ 14? I've
> currently got a hacky substitute which is really char, but I'd like
> something better, if somebody already has implemented char_traits et al
> for older C++.

With both gcc (9.1) and Clang (7, 8) you can enable char8_t with the
'-fchar8_t' option for earlier standard modes. I'm not sure that is
helpful for your use case though.

If you can't use the '-fchar8_t' option, then you have two options:

 1. Introduce a 'char8_t' type alias of 'char' that is for documentation
    purposes only. Obviously, you won't be able to overload based on that.
 2. Take JeanHeyd's suggestion and introduce a 'char8_t' alias of
    'unsigned char' and roll your own 'char_traits' and friends.

Tom.


Received on 2019-07-31 18:21:26