|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2004-07-14 17:23:58
Toon Knapen wrote:
> David Abrahams wrote:
>
>
>> Ultimately I think the right answer is to use
>> mpl::integral_c<some_type, some_value>
>>
>> or
>>
>> mpl::bool_<some_value>
>>
>> etc.
>>
>> everywhere as Paul Mensonides suggested. One reason is that it
>> centralizes the out-of-line static member definitions.
>>
>
> I tried this (in the algorithm/string library where I also tested the
> enum trick for Pavol Droba) and just replaced in
> algorithm/string/std/string_traits.hpp following lines
>
> enum { value = false } ;
> typedef mpl::bool_< value > type ;
>
> with
>
> typedef mpl::bool_< false > value ;
> typedef mpl::bool_< value > type ;
>
> and this evidently results in a compilation error.
Doesn't surprise me. You can't just replace an integral constant with a
type!
> I am not very fluent
> in mpl but AFAICT this seems like a nice solution but not exactly a
> drop-in replacement for the current situation.
Not if you do that! I must've failed to make the 2nd half of my posting
comprehensible.
I don't know how to make it more comprehensible other than to say,
"please try what I suggested in the 2nd half of my posting". I guess I
can also say that bool_< x > has a nested static bool constant ::value
equal to x.
-- Dave Abrahams Boost Consulting http://www.boost-consulting.com
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk