mirror of
https://github.com/bolero-MURAKAMI/Sprout.git
synced 2025-07-02 14:04:20 +00:00
add identity
This commit is contained in:
parent
2cb55b6b6c
commit
a2b368a7cc
11 changed files with 85 additions and 63 deletions
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <type_traits>
|
||||
#include <sprout/config.hpp>
|
||||
#include <sprout/type_traits/identity.hpp>
|
||||
#include HDR_FUNCTIONAL_SSCRISK_CEL_OR_SPROUT
|
||||
|
||||
namespace sprout {
|
||||
|
@ -11,7 +12,7 @@ namespace sprout {
|
|||
//
|
||||
template<typename T, typename Compare>
|
||||
inline SPROUT_CONSTEXPR T const&
|
||||
clamp(T const& value, typename std::common_type<T>::type const& low, typename std::common_type<T>::type const& high, Compare comp) {
|
||||
clamp(T const& value, typename sprout::identity<T>::type const& low, typename sprout::identity<T>::type const& high, Compare comp) {
|
||||
return comp(value, low) ? low
|
||||
: comp(high, value) ? high
|
||||
: value
|
||||
|
@ -19,7 +20,7 @@ namespace sprout {
|
|||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR T const&
|
||||
clamp(T const& value, typename std::common_type<T>::type const& low, typename std::common_type<T>::type const& high) {
|
||||
clamp(T const& value, typename sprout::identity<T>::type const& low, typename sprout::identity<T>::type const& high) {
|
||||
return sprout::clamp(
|
||||
value, low, high,
|
||||
NS_SSCRISK_CEL_OR_SPROUT::less<T>()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue