Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct stupidCastTest {
- float* data;
- operator float* () {
- return data;
- }
- float& operator [] (long idx) {
- return data[idx];
- }
- }
- int main () {
- stupidCastTest instance;
- instance.data = new float[10];
- instance[3] = 5; // by logic it would call the overloaded operator,
- // but ISO says it is not clear whether it should
- // call ((float*)instance)[3] or instance[3].
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement