Compile-time solution to detect that an Eigen object does not have an eval() member?

Most Eigen classes have an eval() method that force their evaluation. Some classes don't, for example matrix decompositions. Is there a way to distinguish between these classes at compile-time?


You can define your own trait which uses SFINAE to determine this:

namespace detail
    template<typename T>
    auto has_eval_impl(void*)
        -> decltype(std::declval<T>().eval(), std::true_type());

    template<typename T>
    auto has_eval_impl(...) -> std::false_type;

template<typename T>
struct has_eval : decltype(detail::has_eval_impl<T>(nullptr)) { };

Need Your Help

Check if a dependency is correctly added in gradle

java maven gradle

I added this dependency to my build.gradle: