On Monday, June 03, 2013 00:36:46 Temtaime wrote:
> I'm writing serializer and it iterates all members of struct.
> It compares fields marked as "enum" when reading from file to
> check BOM, for example.
>
> I'm using enum now because const members are deprecated in 2.063.
The equivalent to what
On Monday, June 03, 2013 00:34:49 Temtaime wrote:
> It's intresting.
> So the only way to pass "a" to overloaded function like that ?
>
> void foo(T)(ref T) { writeln("true"); }
> void foo(T)(auto ref in T) { writeln("false"); }
>
> enum int a = 10;
> foo(a); // false
>
> int b = 1;
> foo(b); //
I'm writing serializer and it iterates all members of struct.
It compares fields marked as "enum" when reading from file to
check BOM, for example.
I'm using enum now because const members are deprecated in 2.063.
It's intresting.
So the only way to pass "a" to overloaded function like that ?
void foo(T)(ref T) { writeln("true"); }
void foo(T)(auto ref in T) { writeln("false"); }
enum int a = 10;
foo(a); // false
int b = 1;
foo(b); // true
Temtaime:
enum int a = 5;
writeln(isMutable!(typeof(a)));
Writes true. Why?
If you run this:
enum int a = 5;
pragma(msg, typeof(a));
void main() {}
It prints "int". An int is mutable.
How i can figure out if variable is "enum" constant ?
Why do you need to know that?
On Monday, June 03, 2013 00:14:34 Temtaime wrote:
> Hi!
>
> enum int a = 5;
> writeln(isMutable!(typeof(a)));
>
> Writes true. Why? How i can figure out if variable is "enum"
> constant ?
> Thanks.
> Regards.
isMutable just checks whether the type const or immutable, and is true if i
Hi!
enum int a = 5;
writeln(isMutable!(typeof(a)));
Writes true. Why? How i can figure out if variable is "enum"
constant ?
Thanks.
Regards.