C++ Logo

SG16

Advanced search

Subject: Re: [SG16-Unicode] String views with strong code unit types
From: Giuseppe D'Angelo (giuseppe.dangelo_at_[hidden])
Date: 2019-06-04 06:07:12


Hi,

Il 04/06/19 09:38, Lyberta ha scritto:
> I'm trying to replicate a "sv" UDL with strong code unit types.
>
> constexpr auto operator "" _cus(const char8_t* literal, std::size_t size)
>
> As view types require some outside storage, I'm will need to create an
> array of code units in static memory. I'm not sure how to do that. Also,
> the compiler says that "size" is not a constant expression. Any ideas?

Something like this, or did I misunderstand what you're after?

(Requires non-portable GCC extensions)

> https://gcc.godbolt.org/z/Evi5rD

Best regards,

-- 
Giuseppe D'Angelo | giuseppe.dangelo_at_[hidden] | Senior Software Engineer
KDAB (France) S.A.S., a KDAB Group company
Tel. France +33 (0)4 90 84 08 53, http://www.kdab.com
KDAB - The Qt, C++ and OpenGL Experts



SG16 list run by sg16-owner@lists.isocpp.org