Commit 5024931b authored by Jan Koniarik's avatar Jan Koniarik
Browse files

added convert_to function

parent 650aebc6
Pipeline #80782 passed with stage
in 29 seconds
...@@ -41,6 +41,15 @@ constexpr int sign(T &&val) { ...@@ -41,6 +41,15 @@ constexpr int sign(T &&val) {
return 0; return 0;
} }
template <typename T>
struct convert_to {
template <typename U>
constexpr T operator()(U &&src) const noexcept(noexcept(T{std::forward<U>(src)})) {
return T{std::forward<U>(src)};
}
};
template <typename T> template <typename T>
constexpr T clamp(T val, T from, T to) { constexpr T clamp(T val, T from, T to) {
if (val < from) { if (val < from) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment