From: David Abrahams (dave_at_[hidden])
Date: 2003-04-27 09:46:06
Mike Conley <conley.141_at_[hidden]> writes:
> "John Maddock" <john_maddock_at_[hidden]> wrote in
>> The problem is that the question "is A convertible to B" has four
>> answers: yes, no, ill-formed, and ambiguous :-(
> Obviously, I think there should be only two :) That is, it would be nice
> to have a test that tells me the whether or not an assignment would or
> would not succeed. If I want to assign the result of an expression to a
> variable (or use it as a return value, etc), I don't particularly care WHY
> an assignment would fail. I just want to know whether it would or not.
The problem I was trying to point out with is_const_or_int_convertible
was that if you want it to "just work" you really want some way of
"grabbing context" at the interface to any metafunction that might
need it, and passing it all the way down into is_convertible, so that
it gets evaluated in the context of the "outer invocation" whatever
> Perhaps it would be useful to have a set of tests that can tell you whether
> a conversion would fail for a specific reason, eg, conversion_is_ambiguous
Which begs the same question as the one I'm harping on above.
> But the real problem, as I see it, is that is_convertible<X,Y> can fail to
> compile for certain choices of X and Y. That defeats the purpose of the
> test -- why would I ask if I can convert an X to a Y if I must already know
> the answer to do so safely?
That's a whole different (and soluble, in the core) matter.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk