简体   繁体   中英

overload member selection operator

is there any way to overload the "dot"-operator "."

We would like to use our old code base while rewriting the ORM layer. So we had the idea to wrap the objects and add some new semantic to the member selection operator "."

We found a several sites discussing that, including here on SO, all say in theory it would be fine but current C++ standard does not allow it.

Maybe there is already a compiler which does it?

EDIT

thanks for your quick answers; We see it might be hard if not impossible to find such a compiler. Any further hints are appreciated. All your posted resources we already had read...

Briefly what we want to achieve: The wrapper does not have any own members, it just should provide the former real object in another way. It would be very convenient to implement our new layer for reasons of backward compatibility - we could avoid to modify the legacy client code in about >4000 occurrences.

If you have any other idea how to proceed in another way, please tell. Will this limit be still there in C++11 ?

EDIT 2

Not sure yet, I am going to report what we do.

You can't overload the dot operator, and there is no c++ compiler that supports this property. Check this link from wikipedia which explains operator overloading in C++ in more detail. http://en.wikipedia.org/wiki/C%2B%2B_operators

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM