Skip to content
Snippets Groups Projects
Commit 426755eb authored by Elias Pipping's avatar Elias Pipping
Browse files

Comment on std::clamp

parent 251ecfbb
Branches
No related tags found
No related merge requests found
Pipeline #
......@@ -61,6 +61,9 @@ public:
*/
field_type projectIn(const field_type& x) const
{
// NB: C++17 has std::clamp(x, data_[0], data_[1]).
// Note, however, that we need to guarantee neither
// data_[0] nor data_[1] is NaN then.
return std::max(std::min(x,data_[1]), data_[0]);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment