Functors.hpp
Go to the documentation of this file.
1 /*
2  * Functors.hpp
3  *
4  * Created on: Nov 23, 2015
5  * Author: Péter Fankhauser
6  * Institute: ETH Zurich, ANYbotics
7  */
8 
9 #pragma once
10 
11 namespace grid_map {
12 
13 template<typename Scalar>
14 struct Clamp
15 {
16  Clamp(const Scalar& min, const Scalar& max)
17  : min_(min),
18  max_(max)
19  {
20  }
21  const Scalar operator()(const Scalar& x) const
22  {
23  return x < min_ ? min_ : (x > max_ ? max_ : x);
24  }
25  Scalar min_, max_;
26 };
27 
28 }
const Scalar operator()(const Scalar &x) const
Definition: Functors.hpp:21
Clamp(const Scalar &min, const Scalar &max)
Definition: Functors.hpp:16


grid_map_core
Author(s): Péter Fankhauser
autogenerated on Tue Jun 25 2019 20:02:08