add identity

This commit is contained in:
bolero-MURAKAMI 2013-03-21 22:11:40 +09:00
parent 2cb55b6b6c
commit a2b368a7cc
11 changed files with 85 additions and 63 deletions

View file

@ -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>()