|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2002-02-21 16:36:27
On Thursday, February 21, 2002, at 04:18 PM, David Abrahams wrote:
> In my use of type_traits, I've frequently wanted to be able to turn
> boolean
> values into tags for tag dispatching, e.g.:
>
> return dispatch_function(&x, boost::is_const<X>::type());
>
> As it stands, I can write:
>
> template <bool> struct bool_t {};
> return dispatch_function(&x, bool_t<boost::is_const<X>::value>());
>
> But, it's a little cumbersome, and nearly all of type_traits ICEs are
> expressed in terms of yes_type and no_type anyway. Any chance of
> institutionalizing this and making it public?
I often need to do this myself. I usually use:
return dispatch_function(&x, int2type<boost::is_const<X>::value>());
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk