Skip to content
Snippets Groups Projects
Commit 0022b7c9 authored by Carsten Gräser's avatar Carsten Gräser
Browse files

Add Hybrid::equals()

parent 9cc7d89c
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -363,7 +363,34 @@ constexpr void ifElse(const Condition& condition, IfFunc&& ifFunc) ...@@ -363,7 +363,34 @@ constexpr void ifElse(const Condition& condition, IfFunc&& ifFunc)
namespace Imp {
template<class T1, class T2>
constexpr auto equals(T1&& t1, T2&& t2, PriorityTag<1>) -> decltype(T1::value, T2::value, std::integral_constant<bool,T1::value == T2::value>())
{ return {}; }
template<class T1, class T2>
constexpr auto equals(T1&& t1, T2&& t2, PriorityTag<0>)
{
return t1==t2;
}
} // namespace Imp
/**
* \brief Equality comparison
*
* If both types have a static member value, the result of comparing
* these is returned as std::integral_constant<bool, *>. Otherwise
* the result of a runtime comparison of t1 and t2 is directly returned.
*/
template<class T1, class T2>
constexpr auto equals(T1&& t1, T2&& t2)
{
return Hybrid::Imp::equals(std::forward<T1>(t1), std::forward<T2>(t2), PriorityTag<1>());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment