-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatemanager.h
29 lines (24 loc) · 1.1 KB
/
statemanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#pragma once
#include <vector>
template <class counterInt_type, class operatingInt_type> class stateManager
{
public:
~stateManager() = delete;
static bool reserveFor(const std :: size_t& maxSize) noexcept;
static counterInt_type counter;
static std :: vector<operatingInt_type> countingBlock;
static operatingInt_type lastCounting;
};
template <class counterInt_type, class operatingInt_type> counterInt_type stateManager <counterInt_type, operatingInt_type> :: counter = {};
template <class counterInt_type, class operatingInt_type> std :: vector<operatingInt_type> stateManager <counterInt_type, operatingInt_type> :: countingBlock = {};
template <class counterInt_type, class operatingInt_type> operatingInt_type stateManager <counterInt_type, operatingInt_type> :: lastCounting = {};
template <class counterInt_type, class operatingInt_type> inline bool stateManager <counterInt_type, operatingInt_type> :: reserveFor(const std :: size_t& maxSize) noexcept
{
try
{
stateManager <counterInt_type, operatingInt_type> :: countingBlock.reserve(sqrtl(maxSize));
return true;
}
catch (...) {}
return false;
}