From: Samuel Krempp (krempp_at_[hidden])
Date: 2002-02-23 11:52:09
On Sat, 2002-02-23 at 17:30, rogeeff wrote:
> Could you explain how it is working ? What is the role of second
> argument? Why long/int? Why 1L? How to extend this technique for more
> then 2 cases.
I can see that the int / long is there so that the compiler focus on
this argument, if the others are found equal.
I think I understood the problem with MSVC now : it is when he has a
A<int>, and finds that he can call both functions with this argument
without one requiring less conversion than the other. It does not try to
see if one of the function is more "specified" than the other, like the
norm would require it to do.
so the call is ambiguous for MSVC.
Using a long / int, it gives it a way to favor the function we want,
without needing to see which function is more specified.
(using long / int / char, we can artificially order 3 types, etc..)
I'm currently implementing the trick on format, and it should be the
last of the msvc workarounds.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk