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 18:01:35 UTC 2020


On Sunday, 20 September 2020 at 17:08:49 UTC, realhet wrote:
> On Sunday, 20 September 2020 at 16:18:19 UTC, Steven 
> Schveighoffer wrote:
>> On 9/20/20 11:52 AM, realhet wrote:
>>> On Sunday, 20 September 2020 at 14:54:09 UTC, Steven 
>>> Schveighoffer wrote:
>>>> On 9/20/20 9:30 AM, realhet wrote:
>> Yeah, I think this might work.

https://gist.github.com/run-dlang/4b4d4de81c20a082d72eb61307db2946

Here's a little example.
In the main() there are the requirements.
Below that is the implementation. If it is ugly, please tell me 
how to make it prettier :D

Once I was able to make the compiler for a really long time, so I 
know it is rather templates than explicit mixins. All the 
swizzles that cover a contiguous area are mixed in though: in a 4 
element vector it is: only a few elements: "x", "y", "z", "w", 
"xy", "yz", "zw", "xyz", "yzw", "xyzw", "r", "g", "b", "a", "rg", 
"gb", "ba", "rgb", "gba", "rgba", "s", "t", "p", "q", "st", "tp", 
"pq", "stp", "tpq", "stpq"
For everything there is opDispatch.


More information about the Digitalmars-d-learn mailing list