From -3291625422932810237
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e7ce30bc16218953
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2003-01-07 16:29:50 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!wn14feed!wn12feed!worldnet.att.net!4.24.21.153!chcgil2-snh1.gtei.net!nycmny1-snf1.gtei.net!news.gtei.net!colt.net!kibo.news.demon.net!mutlu.news.demon.net!demon!mail2news.demon.co.uk!devnull
From: tom_usenet@hotmail.com (tom_usenet)
Newsgroups: comp.std.c++
Subject: Re: function template specialization deduction
Date: Wed, 8 Jan 2003 00:29:46 +0000 (UTC)
Organization: [posted via Easynet UK]
Lines: 46
Approved: fjh@cs.mu.oz.au (Fergus Henderson , moderator of comp.std.c++)
Message-ID: <3e1b2558.465768343@news.easynet.co.uk>
References: <avf2t8$krl$1@sunsite.dk>
X-Trace: mail2news.demon.co.uk 1041985786 12335 10.0.0.1 (8 Jan 2003 00:29:46 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Wed, 8 Jan 2003 00:29:46 +0000 (UTC)
X-Received: from mulga.cs.mu.oz.au ([128.250.1.22])
	by news.demon.co.uk with esmtp (Exim 4.05)
	id 18W46J-0003Co-00
	for mail2news@news.news.demon.net; Wed, 08 Jan 2003 00:29:44 +0000
X-Received: from localhost (localhost [[UNIX: localhost]]) by mulga.cs.mu.OZ.AU
	id LAA04070; Wed, 8 Jan 2003 11:29:40 +1100 (EST)
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Path: comp-std-cpp-robomod!not-for-mail
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
X-Delivered-To: std-c++@ncar.ucar.edu
X-Newsgroups: comp.std.c++
X-Newsreader: Forte Free Agent 1.21/32.243
X-Spam-Status: No, hits=-8.7 required=5.0
	tests=EMAIL_ATTRIBUTION,FORGED_HOTMAIL_RCVD,NOSPAM_INC,
	      QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01
	version=2.41
Xref: archiver1.google.com comp.std.c++:16868

On Tue, 7 Jan 2003 18:55:11 +0000 (UTC), nesotto@cs.auc.dk ("THORSTEN
OTTOSEN") wrote:

>Hi,

Hello.

[SNIP]

>My problem is then simply that cannot explain why
>the latter version is a better
>match than the first. I have tried looking at paragraph 13.3.3, 14.5.52 and
>14.8.3 but could not find anything
>that says that
>
>template< typename C, typename V >
> inline void insert( C& c, const V& );
>
>is a worse match than
>
> template< typename A >
> inline void
> insert( A& c, const typename A::container_type::value_type& v );
>
>Is there some rule that "fewer template parameters is better" ?

Not exactly, but the partial function ordering rules in 14.5.5.2 pick
the second in favour of the first.

Basically, the first can match every argument type that the second can
match using template argument deduction for each argument, but the
second cannot match all those of the first (specifically when V isn't
the same as C::container_type::value_type). 

Divining that rule-of-thumb from the standardese in 14.5.5.2 requires
a bit of work;  I haven't really done that work but the rule seems
intuitive enough.

Tom

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



