Mike Conley <[EMAIL PROTECTED]> writes:

> David Abrahams <[EMAIL PROTECTED]> wrote in 
> news:[EMAIL PROTECTED]:
>
>> That completely scuttles the ODR, as far as I can tell.
>
> Naturally, you wouldn't want to use a built in is_convertible this way.  
> Better to pass it as a template parameter directly, rather than wrapping 
> it:  and_<is_const<T>, is_convertible<T,int> >.  
>
> If you know that the result of is_convertible depends on context, and you 
> know about the ODR, then you know not to use is_convertible to as part of a 
> metafunction's return value without also making it part of the 
> metafunction's type (ie, using it as a template parameter).

It doesn't matter if it's a template parameter.  It's an ODR violation
to have:

    template <>
    struct is_whatever<X>
    {
       static bool const value = false;
    };

and

    template <>
    struct is_whatever<X>
    {
       static bool const value = true;
    };

in the same program, which is essentially the effect if is_whatever
uses a context-dependent is_convertible in its body.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to