|
Boost Users : |
From: David Abrahams (dave_at_[hidden])
Date: 2005-01-07 08:26:15
Aleksey Gurtovoy wrote:
> John Maddock writes:
>>> how do I express through template metaprogramming or in a similar
>>> way that a class is convertible to a template class for some T1?
>>> I.e., the condition: "There exists some T1 such that B is
>>> convertible to A<T1>". An example program: (Platform: VC++7.1)
>>
>> I guess you want the type-trait: is_convertible<from, to>.
>
> In his case, 'to' is an unbound family of types ('A<X>' for any 'X'),
> so 'is_convertible' won't do it. May be we should consider getting
> this in the library, in some form. E.g. tweak 'is_convertible' to
> support something like
>
> is_convertible<from, A<_> >
>
How are you going to implement it? Overload resolution for function
templates ignores user-defined conversions.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net