From: Frank Bergemann on
i had a closer look at the description in is_base_and_derived.hpp and
can more match it now with
http://groups.google.com/group/comp.lang.c++.moderated/msg/dd6c4e4d5160bd83.
-----------------------------------
Following conversions are possible
1) C -> C const (SC - Qualification Adjustment) -> B const volatile*
(UDC) => NO
2) C -> D const volatile* (UDC) -> B1/B2 const volatile* -> B const
volatile* (SC - Conversion) => NO
3) C -> D const volatile* (UDC) => YES
-----------------------------------
If D IS derived from B, then in principle all #3 options are available.
However there is a first selection to be done for the #2 NO-way options
1) and 2). For this the number of non-UDC steps before the (first) UDC
rules:
1) has #1 (the Qualification Adjustment)
2) has #0.
That's why 2) is selected for the NO-way.
For the YES-way there is only option 3).
Now the choice is between
2) - for the NO-way and
3) - for the YES-way.
This time 3) is preferred (the YES-way), because both have NO additional
step before the UDC, but 2) requires additional conversions next, while
3) doesn't (is finished).

I.e. here the mechanism is based on forcing the selection of 2) amongst
1) & 2) first - by introducing the const qualifier for the C::operator B
conversion. But then next, 2) is "more expensive" than 3).
-----------------------------------
If D IS NOT derived from B, then only 1) and 3) are available.
For this 1) is made "more expensive" by using a template type parameter
T. But before this is evaluated, again there is considered the involved
conversions. And this time i can't understand the description in
is_base_and_derived.hpp. Because it says, both are judged equal.
But isn't there the additional C -> C const (SC - Qualification
Adjustment) for 1), which should prefer 3?

???

regards,
Frank

--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]