chromium/mojo/public/cpp/bindings/lib/hash_util.h

// Copyright 2016 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_HASH_UTIL_H_
#define MOJO_PUBLIC_CPP_BINDINGS_LIB_HASH_UTIL_H_

#include <cstring>
#include <functional>
#include <optional>
#include <type_traits>
#include <vector>

#include "mojo/public/cpp/bindings/lib/template_util.h"

namespace mojo {
namespace internal {

template <typename T>
size_t HashCombine(size_t seed, const T& value) {}

template <typename T, typename SFINAE = void>
struct HasHashMethod : std::false_type {};

HasHashMethod<T, std::void_t<decltype(std::declval<T>().Hash(size_t{0}))>>;

template <typename T, bool has_hash_method = HasHashMethod<T>::value>
struct HashTraits;

template <typename T>
size_t Hash(size_t seed, const T& value);

HashTraits<T, true>;

HashTraits<T, false>;

HashTraits<std::vector<T>, false>;

HashTraits<std::optional<std::vector<T>>, false>;

template <typename T>
size_t Hash(size_t seed, const T& value) {}

}  // namespace internal
}  // namespace mojo

#endif  // MOJO_PUBLIC_CPP_BINDINGS_LIB_HASH_UTIL_H_