[Boost-bugs] [Boost C++ Libraries] #3215: Clamp function

Subject: [Boost-bugs] [Boost C++ Libraries] #3215: Clamp function
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-06-24 10:53:28


#3215: Clamp function
----------------------------------+-----------------------------------------
 Reporter: olafvdspek@… | Owner:
     Type: Feature Requests | Status: new
Milestone: Boost 1.40.0 | Component: None
  Version: Boost 1.39.0 | Severity: Problem
 Keywords: |
----------------------------------+-----------------------------------------
 A clamp function comes in handy in certain cases. Could one be added to
 Boost? I'm not sure which component would be most appropriate.

 The function may be something like this:
 {{{
 template<class T>
 T clamp(T v, T a, T b)
 {
     return max(a, min(v, b));
 }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3215>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:00 UTC