hash/{std,tuple}: operators should be const
This commit is contained in:
parent
ef309fd4de
commit
e02a4e2594
@ -12,7 +12,7 @@ namespace cruft::hash {
|
||||
// Useful as a component in more complex hash objects (eg, hash::tuple)
|
||||
struct std {
|
||||
template <typename ValueT>
|
||||
auto operator () (ValueT &&val)
|
||||
auto operator () (ValueT &&val) const
|
||||
{
|
||||
using inner_t = ::std::remove_cvref_t<ValueT>;
|
||||
return ::std::hash<inner_t> {} (::std::forward<ValueT> (val));
|
||||
|
@ -19,7 +19,7 @@ namespace cruft::hash {
|
||||
public:
|
||||
template <typename ...ValueT>
|
||||
auto
|
||||
operator() (std::tuple<ValueT...> const &val)
|
||||
operator() (std::tuple<ValueT...> const &val) const
|
||||
{
|
||||
return compute (val, std::make_index_sequence<sizeof... (ValueT)> {});
|
||||
}
|
||||
@ -27,7 +27,7 @@ namespace cruft::hash {
|
||||
private:
|
||||
template <typename ...ValueT, std::size_t ...IndexV>
|
||||
auto
|
||||
compute (std::tuple<ValueT...> const &val, std::index_sequence<IndexV...>)
|
||||
compute (std::tuple<ValueT...> const &val, std::index_sequence<IndexV...>) const
|
||||
{
|
||||
return MixT {} (
|
||||
ElementT {} (std::get<IndexV> (val))...
|
||||
|
Loading…
Reference in New Issue
Block a user