You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Enable declaring constexpr funcs/vars with ==, improve enum/flag_enum
Simplifying `enum` and `flag_enum` needed:
- evolving the `==` compile-time alias design to be the way we we express compile-time `constexpr` functions and objects
- including to work around Cpp1's limitation on declaring `constexpr`/`inline`/`static` members of a type that have an incomplete type, including the same type being defined, by using the dance described in https://stackoverflow.com/questions/11928089/
- enabling emitting `operator<<` as a `friend` function
I'm thinking that, for consistency, a function scope object alias should also declare a constexpr object.
We can already use statement parameters for object aliases:
f: () = {
(x := a,
inout y: const _ = b) {
…;
}
}
Unrelated, and with regards to statement parameters.
x := a currently lowers to auto const& x = a.
But a could be a global, so optimizing like in parameters might make sense.
Although we have copy x := a for that case.
And unlike function parameters, statement parameters have more context to explicitly choose.
But I'm still unsure where the optimization for in parameters sits in the case of statement parameters.
4 commit comments
JohelEGP commentedon Sep 27, 2023
I wonder if we'll be using
===
to define the expert-levelconsteval
functions.JohelEGP commentedon Sep 27, 2023
Or for function-scope
constexpr
objects.JohelEGP commentedon Oct 3, 2023
I'm thinking that, for consistency, a function scope object alias should also declare a
constexpr
object.We can already use statement parameters for object aliases:
Unrelated, and with regards to statement parameters.
x := a
currently lowers toauto const& x = a
.But
a
could be a global, so optimizing likein
parameters might make sense.Although we have
copy x := a
for that case.And unlike function parameters, statement parameters have more context to explicitly choose.
But I'm still unsure where the optimization for
in
parameters sits in the case of statement parameters.JohelEGP commentedon Oct 3, 2023
The syntax for function scope
constexpr
objectsshouldn't close the possibility of also declaring them
static
.It really makes a difference:
constexpr
(And Use This Instead!).static constexpr
vsinline constexpr
.