Subject: Re: [boost] [type traits] Strange behaviour of comparison operators with pointers
From: Edward Diener (eldiener_at_[hidden])
Date: 2011-06-21 08:09:33
On 6/21/2011 12:57 AM, Frédéric Bron wrote:
>> However I was thinking... Is it not possible to test for const int x being 0
>> at compile time, possibly with MPL equal_to ? Then you could handle the case
>> where the "int const" is 0, returning true when that is the case, otherwise
>> returning false.
> In fact, if it is an "integral constant expression", the answer is
> yes. But if not, I suspect the code would yield a compile time error.
One could always check first at compile time with is_same.
> But the arguments of the trait are types not linked to any value.
Yes, of course. Sorry for the noise. It is clearly up to the user of
your operators to look at a value if available. But thanks for bringing
up a good point.
> it seems to me that it is impossible.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk