C++ Logo


Advanced search

Re: [std-proposals] How to propose a feature?

From: Tiago Freire <tmiguelf_at_[hidden]>
Date: Tue, 13 Feb 2024 20:47:24 +0000
This did not trickle because we were having a private discussion, but aliasing all kinds of declarations with the keyword “using” kind of already exists.


But in the context of namespaces, and the entities need to preserve their name as they are being declared in separate namespaces.

namespace A
                struct MyType{};
                std::string_view foo(int);

                struct MyTemplate;

uint32_t global_var;
namespace B
                using ::A::MyType; //allowed
using ::A:: foo; //allowed
using ::A::MyTemplate; //allowed
using ::A:: global_var; //allowed

                using costom_t = ::A::MyType; //if this is allowed?
                using custom_foo = ::A:: foo; //why not this?
using custom_template = ::A::MyTemplate; //or this?
using custom_global = ::A::global_var; //or this?

From: Std-Proposals <std-proposals-bounces_at_[hidden]rg> On Behalf Of Sebastian Wittmeier via Std-Proposals
Sent: Tuesday, February 13, 2024 9:33 PM
To: std-proposals_at_[hidden]
Cc: Sebastian Wittmeier <wittmeier_at_projectalpha.org>
Subject: Re: [std-proposals] How to propose a feature?

Hi Barry, hi Baruch,

using-declarations can be used for introducing elsewhere declared namespace members, class members and enumerations.

So as type alias the keyword using may be only used for types, but otherwise as declaration using is used for all kind ob entities.



-----Ursprüngliche Nachricht-----
Von: Barry Revzin via Std-Proposals <std-proposals_at_[hidden]<mailto:std-proposals_at_[hidden]>>
Gesendet: Di 13.02.2024 20:15
Betreff: Re: [std-proposals] How to propose a feature?
An: std-proposals_at_[hidden]<mailto:std-proposals_at_[hidden]>;
CC: Barry Revzin <barry.revzin_at_[hidden]<mailto:barry.revzin_at_[hidden]>>;

It was rejected in part due to the desire for wanting different kinds of alias (alias type vs alias function etc) to actually look different in code, so would either have to come up with whatever that syntax should look like or an argument for why you don't need that syntax. Although now that "down with typename" has been in the standard for a while, it'd be a breaking change to use the same syntax - since now you'd need "typename" again in all of these places.


Received on 2024-02-13 20:47:27