#pragma once #include "../hash.hpp" #include "./mix.hpp" #include namespace cruft::hash { /// Computes a hash for a tuple type by elementwise hashing, then variadic mixing. /// /// \tparam ElementT The per-element hash type /// \tparam MixT The mixing hash type. Must support variadic operator() template < typename ElementT, typename MixT = cruft::hash::mixer > class tuple { public: using is_transparent = void; template auto operator() (std::tuple const &val) const { return compute (val, std::make_index_sequence {}); } private: template auto compute (std::tuple const &val, std::index_sequence) const { return MixT {} ( ElementT {} (std::get (val))... ); } }; }