C++ Logo

std-proposals

Advanced search

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

From: Jason McKesson <jmckesson_at_[hidden]>
Date: Thu, 21 Sep 2023 16:39:14 -0400
On Thu, Sep 21, 2023 at 2:31 PM Ferhat Geçdoğan via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> Most of us use aliases for declaring some complex types with less keywords, or something else.

Citation needed.

> 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?

No. Especially since namespace aliases are a fundamentally different
thing from type aliases.

Why is removing `using` here worthwhile at all?

Received on 2023-09-21 20:39:27