what operator(s) should I overload to prevent this?

drug drug2004 at bk.ru
Mon Oct 16 12:00:13 UTC 2017


I refactored `MyStructure` added own implementation of malloced array 
based on pureRealloc/pureFree instead of dynamic array I used before and 
now I have error:
Error: cannot implicitly convert expression get(msg.getData()) of type 
const(MyStructure) to MyStructure.

What operators should I overload to let this conversion? I've tryed 
opCast and it fails in other call sites, also I've tried opAssign - it 
didn't works, what worked is wrapping in ctor - MyStruct(const_var). But 
using ctor is not convenient.



More information about the Digitalmars-d-learn mailing list