Boost logo

Boost :

Subject: Re: [boost] [Review:Algorithms] Order of args to clamp
From: Michael Fawcett (michael.fawcett_at_[hidden])
Date: 2011-09-23 15:23:47

On Fri, Sep 23, 2011 at 1:09 PM, Stewart, Robert <Robert.Stewart_at_[hidden]> wrote:
> For comparision, the _Clamping (graphics)_ article in Wikipedia uses the current argument order.  That article links to clamp functions, using the same order, in the jsPerf library.  The Code Project has a 2008 article showing a generic C# Clamp() that uses the same order.  I found a number of other examples of the same order.  There's even a "preview only" page in MSDN for a float and an int clamp() that follows this order.  By contrast, in my quick examination of search results, I didn't find any with the low/middle/high order.

FWIW, OpenCL and Cg also use the clamp(x, min, max) order.

--Michael Fawcett

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