borrowed pointers vs ref
w0rp via Digitalmars-d
digitalmars-d at puremagic.com
Mon May 12 14:18:09 PDT 2014
The first thing that comes to my mind is applying this somehow to
the (T) vs (ref T) function problem. (const ref, scope ref,
references to r-values, you know the problem.) At the moment I
just follow this pattern.
void foo(ref const T bar) {
/* ... */
}
// Second overload to make r-values just work.
void foo(const T bar) {
foo(bar);
}
auto ref sometimes works, sometimes it's more trouble than its
worth.
More information about the Digitalmars-d
mailing list