cgrapht 1.0.0
A modern C++20 header-only graph library
Loading...
Searching...
No Matches
default_edge.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <cstddef>
4#include <functional>
5
6namespace cgrapht {
20 struct DefaultEdge {
24 std::size_t id {};
25
31 explicit DefaultEdge(const std::size_t id) : id{id} {}
32 bool operator==(const DefaultEdge& other) const = default;
33 };
34}
35
37template<>
38struct std::hash<cgrapht::DefaultEdge> {
39 std::size_t operator()(const cgrapht::DefaultEdge& edge) const noexcept {
40 return edge.id;
41 }
42};
A library supplied edge type.
DefaultEdge(const std::size_t id)
The constructor accepting a stze_t type argument that it uses as hash later.
std::size_t id
User passed ID parameter that is used as the hash value.
bool operator==(const DefaultEdge &other) const =default