Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Free functions like `std::begin` are meant for generic code. Apart from that, how would you even access the private members if the dot-operator was overloaded? (C++ does not support overloading the dot-operator for good reasons.)


Also with some function, perhaps even the existing one std::get<1>, like for some other existing types where the dot-operator is already broken. The special purpose field-access ability and the special-purpose dot syntax don’t have to the same exact operator, though I appreciate there were logical reasons for C++ to historically choose to combine them




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: