Commit dcc1e3dd authored by Philip Trettner's avatar Philip Trettner
Browse files

added dont_deduce and constant_rational

parent b2ebf0ea
......@@ -8,8 +8,9 @@ namespace polymesh
namespace tmp
{
template <class M, class T>
struct member_fun {
M T::* fun;
struct member_fun
{
M T::*fun;
};
template <class FuncT>
......@@ -29,6 +30,14 @@ struct result_of
using type = decltype(std::declval<FuncT>()(std::declval<ArgT>()));
};
template <class T>
struct dont_deduce_t
{
using type = T;
};
template <class T>
using dont_deduce = typename dont_deduce_t<T>::type;
template <class FuncT, class ArgT>
using result_type_of = typename result_of<FuncT>::template type<ArgT>;
......@@ -79,5 +88,16 @@ struct can_divide_by
value = sizeof(test<T>(0)) == sizeof(bool)
};
};
template <class ScalarT, int Nom, int Denom>
struct constant_rational
{
template <class... Args>
constexpr ScalarT operator()(Args&&...) const
{
return ScalarT(Nom) / ScalarT(Denom);
}
};
} // namespace tmp
} // namespace polymesh
Supports Markdown
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