tetris/Utils/Clamp.h
2018-02-06 01:44:42 +02:00

21 lines
302 B
C++

/*
* Clamp.h
*
* Created on: May 7, 2013
* Author: chibi_000
*/
#ifndef CLAMP_H_
#define CLAMP_H_
#include <algorithm>
template <typename A, typename B, typename C>
A clamp (A value, B minimum, C maximum)
{
return std::min( std::max(value, minimum) , maximum);
}
#endif /* CLAMP_H_ */