C++ Logo


Advanced search

Re: [std-proposals] Grouped-namespace "using" statements (floating the idea)

From: Andrew Tomazos <andrewtomazos_at_[hidden]>
Date: Thu, 27 Apr 2023 10:37:31 +1000
On Wed, Apr 26, 2023 at 11:21 PM Arthur O'Dwyer via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> FWIW, I'm strongly opposed to this. (And I did a double-take at Barry's
> post: is it April Fool's Day already?) C++ isn't Perl; we don't use Unix
> shell globs like that. In C++, curly braces have a couple of different
> meanings (code block, initializer-sequence), but not "shell glob."


using A::{X,Y,Z};


enum A {X,Y,Z};

Notice, both are comma-separated brace-enclosed lists of names. Also, in
both cases, each name is introduced into its parent scope.

A slight alteration we could consider would be:

using A {X,Y,Z};

(drop the extra ::), and then perhaps that seems more natural?

It's a common coding style to have a big block of usings at the top of a
.cpp file. This feature would significantly shorten that block.

Received on 2023-04-27 00:37:44