C++ Logo


Advanced search

Subject: Re: [std-proposals] "Union types" syntactic sugar
From: Michał Piotr Gawron (mcvsama_at_[hidden])
Date: 2020-03-04 08:12:20

On 04.03.2020 15:03, Михаил Найденов wrote:
> Well,
> template<class T>
> concept charOrUInt8 = std::is_same_v<char> || std::is_same_v<uint8_t>;
> void f (charOrUInt8 auto x);
> template<charOrUInt8 T>
> void f (std::basic_string<T> x)
> Close enough, if ask me :)

That still requires writing a series of std::is_same_v<> but this time
I'd also have to invent a name for the concept. I'd like to avoid that
and keep the actual list of types right in the arguments list. Of
course, if I wanted to reuse the allowed types list, I'd use a concept.

Michał Gawron

STD-PROPOSALS list run by herb.sutter at gmail.com

Standard Proposals Archives on Google Groups