Loading...
Searching...
No Matches
range/hash.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#include <ranges>
#include <seqan3/alphabet/hash.hpp>
#include <seqan3/core/range/type_traits.hpp>
namespace std
{
template <std::ranges::input_range urng_t>
requires seqan3::semialphabet<std::ranges::range_reference_t<urng_t>>
struct hash<urng_t>
{
template <std::ranges::input_range urng2_t>
requires seqan3::semialphabet<std::ranges::range_reference_t<urng2_t>>
size_t operator()(urng2_t && range) const noexcept
{
using alphabet_t = std::ranges::range_reference_t<urng_t>;
size_t result{0};
hash<alphabet_t> h{};
for (alphabet_t character : range)
{
result *= seqan3::alphabet_size<alphabet_t>;
result += h(character);
}
return result;
}
};
} // namespace std
type_traits.hpp
Provides various transformation traits used by the range module.
seqan3::alphabet_size
constexpr auto alphabet_size
A type trait that holds the size of a (semi-)alphabet.
Definition alphabet/concept.hpp:834
hash.hpp
Provides overloads for std::hash.
std::hash< urng_t >::hash
T hash(T... args)
std
SeqAn specific customisations in the standard namespace.
std::hash< urng_t >::operator()
size_t operator()(urng2_t &&range) const noexcept
Compute the hash for a range of characters.
Definition range/hash.hpp:40
Hide me