group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
ClientId.hpp
Go to the documentation of this file.
1
3
4#pragma once
5
6#include <functional>
7
9struct ClientId
10{
11 int value = -1;
12};
13
15inline bool operator==(const ClientId& a, const ClientId& b) noexcept
16{
17 return a.value == b.value;
18}
19
21template <>
22struct std::hash<ClientId>
23{
24 std::size_t operator()(const ClientId& id) const noexcept { return std::hash<int>{}(id.value); }
25};
bool operator==(const ClientId &a, const ClientId &b) noexcept
Equality operator for ClientId, compares the underlying value.
Definition ClientId.hpp:15
Associates an entity with a connected network client.
Definition ClientId.hpp:10
int value
Network client ID. -1 = unassigned.
Definition ClientId.hpp:11
std::size_t operator()(const ClientId &id) const noexcept
Definition ClientId.hpp:24