structs are now lvalues - what is with "auto ref"?
Namespace
rswhite4 at googlemail.com
Fri Dec 28 11:38:33 PST 2012
I wrote a workaround for me: I implement it in Romulus. So for
these functions:
[code]
void foo(auto ref const Foo f) {
// do something with f
}
const(int[42]) bar(auto ref const Foo a, auto ref const Foo b)
pure nothrow {
// do something with a and b
}
const(int[42]) quatz(auto ref const Foo a, auto ref const Foo b,
auto ref const Foo c) pure nothrow {
// do something with a and b
}
[/code]
Romulus generates (if they aren't template functions):
[code]
void foo( const Foo f){
return foo(f);
}
void foo(ref const Foo f) {
// do something with f
}
const(int[42]) bar(ref const Foo a, const Foo b)) pure nothrow{
return bar(a,b);
}
const(int[42]) bar(const Foo a, ref const Foo b)) pure nothrow{
return bar(a,b);
}
const(int[42]) bar( const Foo a, const Foo b) pure nothrow{
return bar(a,b);
}
const(int[42]) bar(ref const Foo a, ref const Foo b) pure nothrow
{
// do something with a and b
}
const(int[42]) quatz(ref const Foo a, const Foo b, const Foo c))
pure nothrow{
return quatz(a,b,c);
}
const(int[42]) quatz(const Foo a, ref const Foo b, const Foo c))
pure nothrow{
return quatz(a,b,c);
}
const(int[42]) quatz(const Foo a, const Foo b, ref const Foo c))
pure nothrow{
return quatz(a,b,c);
}
const(int[42]) quatz(ref const Foo a, ref const Foo b, const Foo
c)) pure nothrow{
return quatz(a,b,c);
}
const(int[42]) quatz(const Foo a, ref const Foo b, ref const Foo
c)) pure nothrow{
return quatz(a,b,c);
}
const(int[42]) quatz(ref const Foo a, const Foo b, ref const Foo
c)) pure nothrow{
return quatz(a,b,c);
}
const(int[42]) quatz( const Foo a, const Foo b, const Foo c)
pure nothrow{
return quatz(a,b,c);
}
const(int[42]) quatz(ref const Foo a, ref const Foo b, ref const
Foo c) pure nothrow {
// do something with a and b
}
[/code]
I will push it later on my github account. Maybe someone like it.
More information about the Digitalmars-d-learn
mailing list