using namespace A if any_of{X, Y, Z}

 

One could see it as limitation of using namespace instead.

 

any_of loosely based on pattern matching proposals.
 

-----Ursprüngliche Nachricht-----
Von: Andrew Tomazos via Std-Proposals <std-proposals@lists.isocpp.org>
Gesendet: Do 27.04.2023 02:37
Betreff: Re: [std-proposals] Grouped-namespace "using" statements (floating the idea)
An: std-proposals@lists.isocpp.org;
CC: Andrew Tomazos <andrewtomazos@gmail.com>; John Filleau <john.filleau@gmail.com>;
On Wed, Apr 26, 2023 at 11:21 PM Arthur O'Dwyer via Std-Proposals <std-proposals@lists.isocpp.org> 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."
 
Compare:
 
using A::{X,Y,Z};
 
and
 
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.
 
-- 
 Std-Proposals mailing list
 Std-Proposals@lists.isocpp.org
 https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals