C++ Logo

std-proposals

Advanced search

[std-proposals] Declare multiple aliases at once with `using`.

From: Ferhat Geçdoğan <ferhatgectao_at_[hidden]>
Date: Thu, 21 Sep 2023 21:31:22 +0300
Most of us use aliases for declaring some complex types with less keywords,
or something else. Like this:

`using usize = unsigned long long;
 using int8 = std::int8_t;
 using namespace my_namespace;` etc.

It's doing its job. Although, it looks kinda bad, at least in my opinion.
So, splitting them with a comma operator with one `using` would be a great
idea. We are doing same thing in variable declarations:

`int x { 42 }, *y;`

With that suggested feature, we can use one `using` for multiple alias
declarations. Like this:

`using usize = unsigned long long,
 int8 = std::int8_t,
 namespace my_namespace;`.

Isn't that useful?

Received on 2023-09-21 18:31:37