Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
kevincox
on April 7, 2021
|
parent
|
context
|
favorite
| on:
First C compiler ported to GCC
How does this work in C++ with operator overloading. Are they still the same? That would make for some interesting obfuscated code.
edflsafoiewq
on April 7, 2021
|
next
[–]
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
on April 7, 2021
|
prev
[–]
> How does this work in C++ with operator overloading.
you can't overload int::operator[](...)
Koshkin
on April 7, 2021
|
parent
[–]
I guess the question was whether the subscript operator is always assumed commutative in C++.
Consider applying for YC's Spring batch! Applications are open till Feb 11.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: