v0.3.0 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
15namespace a3d {
16
17template<typename IdT>
18struct 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} // namespace a3d
27
28#endif // AVARA3D_IDGENERATOR_H