Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
item_id.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <compare>
4#include <cstddef>
5#include <cstdint>
6#include <functional>
7#include <limits>
8
9namespace pulp::timeline {
10
14
19struct ItemId {
20 std::uint64_t value = 0;
21
23 constexpr bool valid() const noexcept {
24 return value != 0 && value != std::numeric_limits<std::uint64_t>::max();
25 }
26 constexpr auto operator<=>(const ItemId&) const = default;
27};
28
30
31} // namespace pulp::timeline
32
33template <> struct std::hash<pulp::timeline::ItemId> {
35 std::size_t operator()(pulp::timeline::ItemId id) const noexcept {
36 return std::hash<std::uint64_t>{}(id.value);
37 }
38};
Definition program_compiler.hpp:18
Definition analyzer_provider.hpp:12
Nonzero monotonic identity for a Timeline-owned object.
Definition item_id.hpp:19
constexpr auto operator<=>(const ItemId &) const =default
constexpr bool valid() const noexcept
Returns whether this value names an object rather than a sentinel.
Definition item_id.hpp:23
std::uint64_t value
Definition item_id.hpp:20
std::size_t operator()(pulp::timeline::ItemId id) const noexcept
Hashes the complete 64-bit identity value.
Definition item_id.hpp:35