stlab.adobe.com Adobe Systems Incorporated

pin
[Non-Mutating Algorithms]


Detailed Description

If value is outside the range (min, max) then the closest of either min or max is returned. If value is within the range specified then value is returned.

Precondition:
min <= max
Postcondition:
min <= result <= max
pin_safe is similar to pin but should be used when you are not sure which bound is the minimum and which is the maximum. It is 'safe' in that, at the cost of an extra comparison, will assert the min and max bounds are placed where they should be when the actual pin is executed.


Functions

template<class T>
const T & pin (const T &min, const T &value, const T &max)
template<class T, typename BinaryPredicate>
const T & pin (const T &min, const T &value, const T &max, BinaryPredicate pred)
template<typename T>
const T & pin_safe (const T &bound1, const T &x, const T &bound2)
template<class T, typename BinaryPredicate>
const T & pin_safe (const T &bound1, const T &x, const T &bound2, BinaryPredicate pred)

Function Documentation

const T& adobe::pin ( const T &  min,
const T &  value,
const T &  max 
)

pin implementation

Definition at line 58 of file pin.hpp.

const T& adobe::pin ( const T &  min,
const T &  value,
const T &  max,
BinaryPredicate  pred 
)

pin implementation

Definition at line 46 of file pin.hpp.

const T& adobe::pin_safe ( const T &  bound1,
const T &  x,
const T &  bound2 
)

pin_safe implementation

Definition at line 85 of file pin.hpp.

const T& adobe::pin_safe ( const T &  bound1,
const T &  x,
const T &  bound2,
BinaryPredicate  pred 
)

pin_safe implementation

Definition at line 70 of file pin.hpp.

Copyright © 2006-2007 Adobe Systems Incorporated.

Use of this website signifies your agreement to the Terms of Use and Online Privacy Policy.

Search powered by Google