|
Boost : |
Subject: Re: [boost] [Boost.Pool] TR1?
From: Phil Bouchard (philippe_at_[hidden])
Date: 2011-04-13 17:17:15
On 4/13/2011 12:49 PM, Nevin Liber wrote:
>
> x< y has a specified order for pointers pointing within the same array or
> object, but is undefined for pointers not pointing in the same array or
> object.
>
> std::less guarantees a total ordering for all pointers, but does not specify
> what that ordering is, even for pointers pointing within the same array or
> object (as the pointer specialization is not required to use x< y to do any
> comparisons).
>
> To make is_from work, we need a total, *specified* ordering for all
> pointers. I see no way to combine the above two to get a total specified
> ordering.
There is s bug in the standards because according to 5.2.10/4 a pointer
can be converted to an integral type to later be ordered. i.e.:
struct Silly
{
bool is_from(const char* p)
{
return !std::less<long>()(reinterpret_cast<long>(p),
reinterpret_cast<long>(buffer)) &&
std::less<long>()(reinterpret_cast<long>(p),
reinterpret_cast<long>(buffer + sizeof(buffer)));
}
char buffer[1024];
};
-Phil
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk