#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: template auto operator() (std::tuple const &val) { return compute (val, std::make_index_sequence {}); } private: template auto compute (std::tuple const &val, std::index_sequence) { return MixT {} ( ElementT {} (std::get (val))... ); } }; }