Commit 2ad186e0 authored by Jan Koniarik's avatar Jan Koniarik
Browse files

added convert_to function

parent c303b7ab
Pipeline #80779 passed with stage
in 31 seconds
......@@ -29,6 +29,14 @@ struct [[deprecated]] identity {
}
};
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)};
}
};
/// returns sign of variable T: -1,0,1
template <typename T>
constexpr int sign(T &&val) {
......
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