Xref: utzoo comp.lang.c++:11429 comp.std.c++:567 Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!att!westmark!mole-end!mat From: mat@mole-end.UUCP (Mark A Terribile) Newsgroups: comp.lang.c++,comp.std.c++ Subject: Re: overloading resolution and const Message-ID: <479@mole-end.UUCP> Date: 3 Feb 91 07:42:33 GMT References: <63156@brunix.UUCP> Organization: mole-end--private system. admin: mole-end!newtnews Lines: 38 In article <63156@brunix.UUCP>, sdm@cs.brown.edu (Scott Meyers) writes: > In the ARM description of conversion sequences for matching actual > parameters to formals during resolution of calls to overloaded functions, > it says the first thing tried is: > [1] Exact match: Sequences of zero or more trivial conversions are > better than all other sequences. Of these, those that do not > convert T* to const T*, T* to volatile T*, T& to const T&, or T& to > volatile T& are better than those that do. (ARM, p. 318.) > How does the fact that not converting to const or volatile is "better" > enter into things? That is, under what conditions would this part of rule > [1] determine which function should be called? > The single-parameter case doesn't seem to lend any insight, since no > compiler I have access to will accept the following two functions in the > same scope: > void f(double) {} > void f(const double) {} Actually, it provides all the insight in the world! The first will be called with an argument of type double , and the second with arguments of type const double . These are probably not the most useful cases. If, on the other hand, you had void f( Something& ); void f( const Something& ); the first would be called when the Something could be altered, and the second when it could not. -- (This man's opinions are his own.) From mole-end Mark Terribile