Added code
This commit is contained in:
		
							
								
								
									
										20
									
								
								Utils/Clamp.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								Utils/Clamp.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
/*
 | 
			
		||||
 * 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_ */
 | 
			
		||||
		Reference in New Issue
	
	Block a user