Avara3D
0.2.0
C++ API reference
IdGenerator.h
1
//
2
// IdGenerator.h
3
// avara3d
4
//
5
// Created by Morgan Davis on 12/21/25.
6
// Copyright © 2026 Morgan K Davis. All rights reserved.
7
//
8
9
#ifndef AVARA3D_IDGENERATOR_H
10
#define AVARA3D_IDGENERATOR_H
11
12
#include <atomic>
13
#include <cstdint>
14
15
namespace
a3d {
16
17
template
<
typename
IdT>
18
struct
IdGenerator {
19
20
static
IdT next() {
21
static
std::atomic<uint32_t> counter {1};
22
return
static_cast<
IdT
>
(counter.fetch_add(1, std::memory_order_relaxed));
23
}
24
};
25
26
}
27
28
#endif
// AVARA3D_IDGENERATOR_H
a3d
IdGenerator.h
Generated by
1.9.4