Topic: c++0x: Unprecise definition of argument deduction during partial ordering
Author: "Schorn, Markus" <Markus.Schorn@windriver.com>
Date: Wed, 6 Oct 2010 15:25:32 CST Raw View
In section [temp.deduct.partial] of the working draft N3126
(2010-08-21):
Number of types parameters:
===========================
The function templates being compared can have a different number of
parameters. It is not mentioned how this situation has to be handled.
Wording for more specialized templates:
=======================================
Paragraph 10 is unclear and also seems to be wrong, it reads:
"If for each type being considered a given template is at least as
specialized for all types and more specialized for some set of types and
the
other template is not more specialized for any types or is not at least
as
specialized for any types, then the given template is more specialized
than
the other template."
It is easier to read when explicitly grouping the conditions:
"If for each type being considered
(a given template is (at least as specialized for all types) and
(more specialized for some set of types)) and
(the other template is (not more specialized for any types) or is
(not at least as specialized for any types)),
then the given template is more specialized than the other template."
(1) Did I get the grouping right?
(2) The leading 'if for each type being considered' does not really make
sense, does it?
(3) The wording excludes the common case where none of the types (of the
given template) is more specialized and at least one of the types of
the other template is not as least as specialzied.
E.g.: 'template<typename T> void f(T)' vs 'template<typename T> void
f(T*)'
(4) The term 'for any type' is used twice but seems to express two
different
things:
'not more specialized for any types'
-> 'there is no type that is more specialized'
'not at least as specialized for any types'
-> 'there is some type that is not as least as specialized'.
If I correctly understood the intent of the paragraph, it should be
reformulated to something like:
If a given template is at least as specialized for all types and
- either the other template is not as least as specialized for some type
- or, the given template is more specialized for at least one type and
for
the other template there is not type that is more specialized,
then the given template is more specialized than the other template.
Is this interpretation correct?
--
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use
mailto:std-c++@netlab.cs.rpi.edu<std-c%2B%2B@netlab.cs.rpi.edu>
]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]