Giuseppe D'AngeloYou’ve got a point with this but shouldn’t it be left to the programmer to know what they’re accessing?
Maybe a simple syntax should be introduced to help with semi-automatic checking if object is dereferencable?
‘’’
try return ptr.innerStruct.member;
else return defaultValue;
‘’’
Which could be sugar syntax checking if everything being accessed by ‘.’ Operator is dereferencable?
Possible done like you would normally with if statements?
Marcin Jaczewski
Maybe it wouldn’t be a bad thing to allow people to use ‘->’ on objects and for plain pointers it would only be syntactical sugar?
Operator overload should still be accessible or alternatively the use of ‘.get()’ for those opposed heavily to the arrow?
Cheers, Filip
Wiadomość napisana przez Giuseppe D'Angelo via Std-Proposals <std-proposals@lists.isocpp.org> w dniu 31 sty 2025, o godz. 11:37:
Giuseppe D'Angelo