Simulant  21.12-194
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
has_auto_id.h
1 #pragma once
2 
3 #include <cstdint>
4 
5 namespace smlt {
6 
7 template<typename T> //< Simply for namespacing IDs
8 class HasAutoID {
9 private:
10  static uint64_t counter;
11 
12  uint64_t auto_id_;
13 
14 public:
15  HasAutoID():
16  auto_id_(++counter) {
17  }
18 
19  virtual ~HasAutoID() {}
20 
21  uint64_t auto_id() const { return auto_id_; }
22 };
23 
24 template<typename T>
25 uint64_t HasAutoID<T>::counter = 0;
26 
27 
28 }
smlt
Definition: animation.cpp:25
smlt::HasAutoID
Definition: has_auto_id.h:8