C++ Logo

STD-PROPOSALS

Advanced search

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


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

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

Standard Proposals Archives on Google Groups