Why is overloading operator&() prohibited for classes stored in STL containers?
- by sharptooth
Suddenly in this article ("problem 2") I see a statement that C++ Standard prohibits using STL containers for storing elemants of class if that class has an overloaded operator&().
Having overloaded operator&() can indeed be problematic, but looks like a default "address-of" operator can be used easily through a set of dirty-looking casts that are used in boost::addressof() and are believed to be portable and standard-compilant.
Why is having an overloaded operator&() prohibited for classes stored in STL containers while the boost::addressof() workaround exists?