C++ Logo

std-proposals

Advanced search

"Union types" syntactic sugar

From: Michał Piotr Gawron <mcvsama_at_[hidden]>
Date: Wed, 4 Mar 2020 09:34:02 +0100
Hello everyone.

Have something like this ever been proposed?

  void f (char|uint8_t x);

as an equivalent to:

  template<class T>
    void f (T x)
      requires (std::is_same_v<char> || std::is_same_v<uint8_t>)

or

  void f (std::basic_string<char|uint8_t> x);

which would be a short for:

  template<class T>
    void f (std::basic_string<T> x)
      requires (std::is_same_v<char> || std::is_same_v<uint8_t>)

std::best_regards();
-- 
Michał Gawron
mcv.mulabs.org

Received on 2020-03-04 02:36:49