On Friday, 4 December 2020 at 12:54:25 UTC, Andrey wrote:
[...]
WTF?
If you come from a C or C++ background, it's quite reasonable to
think of enum stuff like a #define macro. You're using static
arrays, but note that array literals allocate in many use cases.
It really is like a C/C++ macro
On Friday, 4 December 2020 at 12:54:25 UTC, Andrey wrote:
Hello,
void test(const ref string[3] qazzz) { qazzz.writeln; }
void main()
{
enum string[3] value = ["qwer", "ggg", "v"];
test(value);
}
Gives errors:
It works if you pass `-preview=rvaluerefparam` to the compiler.
But the
Thank you!
On Friday, 4 December 2020 at 13:42:45 UTC, Andrey wrote:
Hm, you mean that enum variable is not a real variable?
I thought that to make CT variable you should mark it as enum
(in c++ as constexpr).
How to do it here?
The official name for what you're calling an "enum variable" is
"manifest
On 05/12/2020 2:42 AM, Andrey wrote:
Hm, you mean that enum variable is not a real variable?
It is not a variable. It is a constant that cannot be changed and does
not exist in the executable.
I thought that to make CT variable you should mark it as enum (in c++ as
constexpr).
How to do it
Hm, you mean that enum variable is not a real variable?
I thought that to make CT variable you should mark it as enum (in
c++ as constexpr).
How to do it here?
On 05/12/2020 1:54 AM, Andrey wrote:
Hello,
void test(const ref string[3] qazzz) { qazzz.writeln; }
void main()
{
enum string[3] value = ["qwer", "ggg", "v"];
That is a compile time constant (remove the enum).
test(value);
}
Gives errors:
onlineapp.d(26): Error: function onlinea
Hello,
void test(const ref string[3] qazzz) { qazzz.writeln; }
void main()
{
enum string[3] value = ["qwer", "ggg", "v"];
test(value);
}
Gives errors:
onlineapp.d(26): Error: function onlineapp.test(ref
const(string[3]) qazzz) is not callable using argument types
(string[3])
online