Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-01-21 12:58:47


Gennaro Prota <gennaro_prota_at_[hidden]> writes:

> I don't want to be involved in another war here, also because I'm
> totally ignorant about boost's implementation of is_convertible and
> because I don't know what is its purpose (i.e.: I haven't read the
> documentation and I can just have an idea from its name). I want
> simply to point out that saying a type is or isn't convertible to
> another has a very vague meaning. Note that the definition you quote
> from the standard concerns conversion of an *expression*, not of a
> type. Also it just concerns *implicit* conversion. So, off the top of
> my head, "is convertible" means nothing to me (though I can imagine
> how it is implemented). NOTE: I'm not saying there's an error in
> boost. It's likely that the documentation explains what its meaning
> is, but I don't have time to check now. Note anyway that e.g. (1-1) is
> an expression of type int and that it is implicitly convertible to
> void*, to void (*) int, or to char (A::*)(int) but I doubt that
> is_convertible would yield true on the corresponding types. The exact
> meaning of is_convertible is likely to be understood only if you look
> at the implementation I think, unless there's a very good, and
> technical, explanation in the docs.

That's very well put; I don't think anyone thought very carefully
about the meaning of "convertible" before, and I think we could
probably stand to tighten up our documentation in this area. All it
says right now is:

    Evaluates to true if type T is convertible to type U.
    Types T and U must not be incomplete, abstract or function types.

Can you suggest an appropriate technical explanation?

-- 
                       David Abrahams
   dave_at_[hidden] * http://www.boost-consulting.com
Boost support, enhancements, training, and commercial distribution

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk