Skip to Content
Imperfect C++ Practical Solutions for Real-Life Programming
book

Imperfect C++ Practical Solutions for Real-Life Programming

by Matthew Wilson
October 2004
Intermediate to advanced
624 pages
16h 2m
English
Addison-Wesley Professional
Content preview from Imperfect C++ Practical Solutions for Real-Life Programming

Chapter 26. What's Your Address?

 

Programmers who overload unary operator& should be sentenced to writing libraries that need to operate properly when fed such classes.

 
 --Peter Dimov, esteemed Boost member, Boost newsgroup June 2002

Although that's very funny, it's also a pretty strong statement. Why is there such antipathy to the use of this operator?

In this chapter we look at some of the problems that overloading operator &() can cause. Our solution will be an unexciting one, simply the recommendation that you follow Peter's implicit advice, forswear any use of this overload for shortsighted gains, and avoid much grief down the line.

One thing I should make clear. Anytime in this chapter that I refer to operator &() it will be the unary form, ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical C++ Metaprogramming

Practical C++ Metaprogramming

Edouard Alligand, Joel Falcou

Publisher Resources

ISBN: 0321228774Purchase book