Is there a way to return an lvalue and also an rvalue from the same member function?
realhet
real_het at hotmail.com
Sun Sep 20 13:30:36 UTC 2020
Hi,
struct S{
int[2] array;
ref x() { return array[0]; }
auto x() const { return array[0]; }
}
If there a way to write the function 'x' into one function, not 2
overloads.
I tried auto/const/ref mindlessly :D, also remembered 'inout',
but obviously those weren't solve the problem.
(This is going to be a swizzling 'system' that mimics GLSL, later
I will make a template that takes 'x'as a template parameter,
just wondering that the support for const and non-cons can be
done easier.)
More information about the Digitalmars-d-learn
mailing list