Boost logo

Boost :

From: Mike Conley (conley.141_at_[hidden])
Date: 2003-04-27 11:21:45


David Abrahams <dave_at_[hidden]> wrote in
news:uznmc0wpl.fsf_at_[hidden]:

>> and_<is_const<T>, is_convertible<T,int> >.

OK, this is wrong. What I wanted was a boolean test: is_const<T>::value &&
is_convertible<T,int>. That's not what and_ does. Duh.

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

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

Which is why you pass it as a boolean constant template parameter. Then you can safely
use that parameter in the body. You get the context, and there's no ODR violation.
 

-- 
Mike Conley

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