Functors.hpp
Go to the documentation of this file.
00001 /*
00002  * Functors.hpp
00003  *
00004  *  Created on: Nov 23, 2015
00005  *      Author: Péter Fankhauser
00006  *   Institute: ETH Zurich, ANYbotics
00007  */
00008 
00009 #pragma once
00010 
00011 namespace grid_map {
00012 
00013 template<typename Scalar>
00014 struct Clamp
00015 {
00016   Clamp(const Scalar& min, const Scalar& max)
00017       : min_(min),
00018         max_(max)
00019   {
00020   }
00021   const Scalar operator()(const Scalar& x) const
00022   {
00023     return x < min_ ? min_ : (x > max_ ? max_ : x);
00024   }
00025   Scalar min_, max_;
00026 };
00027 
00028 }


grid_map_core
Author(s): Péter Fankhauser
autogenerated on Tue Jul 9 2019 05:06:13