Is it possible to specify the address returned by the address of operator?

user1234 user1234 at 12.hu
Wed Sep 27 23:24:58 UTC 2017


On Wednesday, 27 September 2017 at 21:01:36 UTC, Jesse Phillips 
wrote:
> On Wednesday, 27 September 2017 at 16:35:54 UTC, DreadKyller 
> wrote:
>> My question is about overloading, several operators can be 
>> overloaded in D, one of the ones that can't apparently is the 
>> address of operator (&object). My question is have I simply 
>> missed it or does it actually not exist, and if it's not 
>> overloadable, is there any reason why this was decided? 
>> Because there's been numerous times that it'd be useful to me, 
>> just recently with how much I use the operator because of 
>> OpenGL I decided to ask.
>
> My answer is that & is a defined operation on all addressable 
> memory. Unlike other operators which don't exist until you 
> "overload" them.

Yes but the dereference operator can be overloaded. The reasoning 
doesn't stand, unless that's recognized as an inconsistency.


More information about the Digitalmars-d-learn mailing list