Boost logo

Boost :

Subject: Re: [boost] [Boost.Pool] TR1?
From: Anders Dalvander (boost_at_[hidden])
Date: 2011-04-13 04:34:08


On 20:59, Phil Bouchard wrote:
> Once again if is_from() was implemented the following way:
> bool is_from(const char* p)
> { return p - buffer > 0 && p - buffer < sizeof(buffer); }
>
> Then the undefined behaviors would seem to go away.

Or if std::less would be used instead of operator<.

struct Silly
{
    bool is_from(const char* p)
    {
       return !std::less<const char*>()(p, buffer) &&
               std::less<const char*>()(p, buffer + sizeof(buffer));
    }

    char buffer[1024];
};

Regards,
Anders Dalvander

-- 
WWFSMD?

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk