std::clamp

GPTKB entity

Statements (21)
Predicate Object
gptkbp:instance_of gptkb:Footballer
gptkbp:bfsLayer 4
gptkbp:bfsParent gptkb:C++17
gptkb:C++17_Standard_Library
gptkbp:bomb_load Yes, for different types.
gptkbp:difficulty Constant time.
gptkbp:error_handling No exceptions thrown.
gptkbp:example std::clamp(10, 1, 5) returns 5.
gptkbp:function std::min, std::max
gptkbp:headliner <algorithm>
gptkbp:is_described_as Clamps a value between a lower and an upper bound.
gptkbp:is_standardized_by gptkb:Library
gptkbp:language gptkb:C++
gptkbp:latest_version gptkb:C++17
gptkbp:namespace std
gptkbp:orbital_period value, low, high
gptkbp:provides_information_on The value if it is between low and high, otherwise low or high.
gptkbp:theme template <class T> T clamp(T value, T low, T high>
gptkbp:type generic function
gptkbp:use_case Limiting user input.
gptkbp:uses Used to restrict a value within a specified range.