Boost logo

Boost :

Subject: Re: [boost] [Review:Algorithms] Order of args to clamp
From: Olaf van der Spek (ml_at_[hidden])
Date: 2011-09-26 11:12:15

On Mon, Sep 26, 2011 at 5:04 PM, Christian Holmquist
<c.holmquist_at_[hidden]> wrote:
>> Is this really the fault of clamp() though?
> No, but clamp can avoid exposing this inherited problem, just as
> std::min/std::max does.

min and max have two 'equivalent' parameters. clamp doesn't, it has
two limits and another argument. The return type is clear, it's the
type of the first argument, that's not the case for min and max.
So I don't think you can use that as an argument.

> The same 'mistake' can easily be made in normal code.
> Yes, and it is causing trouble. We can't go back and change the rules for
> implicit conversions between native types, but when there is a possibility
> to get rid of the legacy I think one should opt to do so.
>> Olaf
>> Christian
> _______________________________________________
> Unsubscribe & other changes:

Boost list run by bdawes at, gregod at, cpdaniel at, john at