Re: Understanding lvalue and rvalue

2017-04-28 Thread ANtlord via Digitalmars-d-learn
On Friday, 28 April 2017 at 05:21:26 UTC, ag0aep6g wrote: Instead of removing `in`/`const` from the ref overload, you can also add it to the non-ref overload. Again, the overloads will have the same match level ("match with conversion to const"), and the ref version will win. It works. I do

Re: Understanding lvalue and rvalue

2017-04-27 Thread ag0aep6g via Digitalmars-d-learn
On 04/28/2017 06:46 AM, ANtlord wrote: struct MyStruct { @disable this(this); int a; } void process(MyStruct obj) { writeln("incoming rvalue"); } void process(in ref MyStruct obj) { writeln("incoming lvalue"); } void main() { MyStruct obj = {a: 1}; process(obj); } Text

Re: Understanding lvalue and rvalue

2017-04-27 Thread ANtlord via Digitalmars-d-learn
On Friday, 28 April 2017 at 04:46:00 UTC, ANtlord wrote: Does make sense for me because it is more obvious in client code, but I want to understand reason of error pointed above. Typo fix. It makes sense for me*

Understanding lvalue and rvalue

2017-04-27 Thread ANtlord via Digitalmars-d-learn
Hello! Short time ago I've met strange thing at least for me. I have a non-copyable structure and two methods for it with same name. I mean that I use function overloading. First method takes rvalue of this structure. Second method takes constant lvalue structure. But when I try to use this fu