Re: [boost] Re: Re: Re: Re: is_convertible: rationale and wording

2003-04-27 Thread David Abrahams
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_convertible >.  
>
> 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
{
   static bool const value = false;
};

and

template <>
struct is_whatever
{
   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


[boost] Re: Re: Re: Re: is_convertible: rationale and wording

2003-04-27 Thread Mike Conley
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_convertible >.  

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).

-- 
Mike Conley


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