1 #pragma once
2 
3 #include <algorithm>
4 
5 namespace pymol
6 {
7 
8 /**
9  * @brief C++17's version of std::clamp
10  */
11 template<typename T>
clamp(const T & value,const T & low,const T & high)12 const T& clamp(const T& value, const T& low, const T& high){
13   return std::max(low, std::min(value, high));
14 }
15 
16 /**
17  * @brief C++14's std::equal
18  */
19 
20 template <typename InIter1, typename InIter2>
equal(InIter1 first1,InIter1 last1,InIter2 first2)21 bool equal(InIter1 first1, InIter1 last1, InIter2 first2)
22 {
23   for (; first1 != last1; ++first1, ++first2) {
24     if (*first1 != *first2) {
25       return false;
26     }
27   }
28   return true;
29 }
30 
31 } // namespace pymol
32