copy must be const?!?
    Dom DiSc 
    dominikus at scherkl.de
       
    Fri Jul 26 07:45:12 UTC 2024
    
    
  
On Friday, 26 July 2024 at 02:34:12 UTC, Andy Valencia wrote:
> On Thursday, 25 July 2024 at 13:07:03 UTC, Jonathan M Davis 
> wrote:
>
>> It's most definitely not a bug that IFTI (Implicit Function 
>> Template Instantiation) instantiates the template with the 
>> exact type that it's given.
>
> The "principle of least astonishment" certainly supports this 
> behavior.  To check my understanding, I forced the type of 
> instantiation:
>
>   writeln(test2!int(v));
>
> and that worked as I expected.
>
> Andy
Yes, it's pretty much the same "solution" but on the caller side 
instead of the callee. But it works only for types like int or 
which provides a constructor that generates a mutable copy.
    
    
More information about the Digitalmars-d-learn
mailing list