#pragma once #include "hash_ext.hpp" struct eq_funcs_fn { template bool operator()(const Eigen::Matrix &lhs, const Eigen::Matrix &rhs, double epsilon = detail::float_hash_epsilon) const { static_assert(M != Eigen::Dynamic && N != Eigen::Dynamic, "only fixed size matrix is supported"); if constexpr (std::is_integral_v) return lhs == rhs; else if constexpr (std::is_floating_point_v) { using integral_type = typename detail::float_to_int_type::type; auto casted_lhs = (lhs.array() / static_cast(epsilon)).template cast(); auto casted_rhs = (rhs.array() / static_cast(epsilon)).template cast(); return casted_lhs.cwiseEqual(casted_rhs).all(); } else static_assert(false, "unsupported type in hash"); } template bool operator()(const Eigen::Transform &lhs, const Eigen::Transform &rhs, double epsilon = detail::float_hash_epsilon) const { if constexpr (std::is_integral_v) return lhs == rhs; else if constexpr (std::is_floating_point_v) { using integral_type = typename detail::float_to_int_type::type; auto casted_lhs = (lhs.affine().array() / static_cast(epsilon)).template cast(); auto casted_rhs = (rhs.affine().array() / static_cast(epsilon)).template cast(); return casted_lhs.cwiseEqual(casted_rhs).all(); } else static_assert(false, "unsupported type in hash"); } }; static constexpr eq_funcs_fn eq_funcs{};