Y
Hacker News
new
|
ask
|
show
|
jobs
by
kevincox
1900 days ago
How does this work in C++ with operator overloading. Are they still the same? That would make for some interesting obfuscated code.
2 comments
edflsafoiewq
1900 days ago
No, they're not. It works by: if either a or b in a[b] is a class/enumeration type, call a.operator[](b).
link
jcelerier
1900 days ago
> How does this work in C++ with operator overloading.
you can't overload int::operator[](...)
link
Koshkin
1900 days ago
I guess the question was whether the subscript operator is always assumed commutative in C++.
link