TITLE: Distinguishing function type signatures PROBLEM: luj@mackinac.ecn.purdue.edu (John Lu) I don't see why for any type T, a T*, const T* and volatile T* CAN be distinguished as the args to a overloaded function; whereas a T and T&(or a T, const T and volatle T) CANNOT be distinguished. I've read ARM Section 13(pp.307-308), but could not get satisfying anwser. Can anyone out there enlighten me ? RESPONSE: steve@taumet.com (Steve Clamage), 24 Mar 1992 Consider the following: f(T); f(T*); f(const T*); T t; const T ct; If we call f(t) or f(ct), there is no argument match to f(T*) or to f(const T*), since t and ct are not of type pointer-to-T. There is a match to f(T). The "const" on ct doesn't matter, since this is call by value, and there is no possibility of modifying the object passed in. (More below on this.) If we call f(&ct), there is no match to f(T), since &ct is of type pointer-to-const-T. There is also no match to f(T*), since that argument must be of type pointer-to-nonconst-T. There is an exact match to f(const T*) -- the formal and actual parameters have exactly the same type. If we call f(&t), either f(T*) or f(const T*) would do, but there is an additional rule that a match to non-const pointer is preferred when the argument is a non-const pointer. So you can see there is no difficulty in distinguishing these three functions. The same arguments apply to volitile. Now consider f(T); f(T&); T t; If we call f(t), how do we pick the version of f() to call? There is no way to prefer one over the other, so you don't want to have both functions. Similarly, consider f(T); f(const T); The functions take value (copy) parameters of type T. The "const" just says that the function will not modify its local copy of the passed-in parameter. This has no consequences for the object passed in by copying, so there is no reason to distinguish between these functions. The same goes for volatile. The actual parameter might be volatile, but the function gets a copy.