Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
kevincox
4y ago
0 comments
Share
How does this work in C++ with operator overloading. Are they still the same? That would make for some interesting obfuscated code.
0 comments
default
newest
oldest
edflsafoiewq
4y 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).
jcelerier
4y ago
> How does this work in C++ with operator overloading.
you can't overload int::operator[](...)
Koshkin
4y ago
I guess the question was whether the subscript operator is always assumed commutative in C++.
j
/
k
navigate · click thread line to collapse