Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
0 points
kevincox
5y ago
0 comments
Save
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
3 comments · 2 top-level
top
newest
oldest
jcelerier
5y ago
· 1 in thread
> How does this work in C++ with operator overloading.
you can't overload int::operator[](...)
Koshkin
5y ago
I guess the question was whether the subscript operator is always assumed commutative in C++.
edflsafoiewq
5y 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).
j
/
k
navigate · click thread line to collapse