#pragma once #include template T Clamp(T const val, T const minVal, T const maxVal) { return std::min(maxVal, std::max(val, minVal)); }