Subject: Re: [boost] [type traits] Strange behaviour of comparison operators with pointers
From: Frédéric Bron (frederic.bron_at_[hidden])
Date: 2011-06-18 08:02:08
>> Then there is no way to predict if it is possible to compare lhs and
>> rhs based only on their types.
> Why do you write this ? Just because 0 can be an integer or a null pointer
> in C++ does not mean the above.
Here it is not literal 0 that can be an integer or a null pointer it
is an const integer of value 0 that can also be considered as a null
pointer... It seems to me that it makes a difference.
If I tell you can you compare "int const" with "int*", you would
probably answer "no" but if the "int const" is 0 the answer is false.
>> The general rule is that it is not
>> possible so that this is what I propose to use for the type trait
>> extension detecting the possibility to call comparison operators on
>> given types.
> To what does "this" refer in your previous sentence ?
I mean that I propose can_call_equal (or whatever name...) < int
const, int * >::value to be false even if there is a possibility for
comparing some int const with int*.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk