cppfront icon indicating copy to clipboard operation
cppfront copied to clipboard

[SUGGESTION] allow `: ==` for anonymous alias declarations (instead of `using`)

Open farmerpiki opened this issue 1 year ago • 7 comments
trafficstars

Proposed syntax:

: == <expr>;

which would compile to using <expr>;

the problem

we should allow a syntax to allow for explicitly saying just using in pure cpp2:

example 1

cpp1: using std::views::split;

in cpp2: split: == std::views::split;

compiles to... the generated code is not what I expected auto inline constexpr split{ std::views::split };

example 2

cpp1: using std::operator""sv;

cpp2: there may be a way with function aliases but it's very cumbersome to use and results in a very ugly syntax compared to the desired outcome...

PS: the purpose for the new syntax was supposed to be simple, easy to use and consistent, this just allows not repeating the name if I want to import something with just using, also it will allow importing all the overloads for a function, I don't think we have a syntax for that yet

farmerpiki avatar Aug 06 '24 11:08 farmerpiki