mirror of
https://gitlab.com/square-game-liberation-front/F.E.I.S.git
synced 2024-11-15 03:27:41 +01:00
21 lines
532 B
C++
21 lines
532 B
C++
#include <any>
|
|
#include <map>
|
|
#include <iostream>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
static std::map<std::string, std::any> old_values;
|
|
|
|
template<class T>
|
|
void track(const std::string& name, const T& value) {
|
|
std::optional<T> old_value;
|
|
auto old_value_it = old_values.find(name);
|
|
if (old_value_it != old_values.end()) {
|
|
old_value = std::any_cast<T>(old_value_it->second);
|
|
}
|
|
|
|
if (old_value != value) {
|
|
old_values[name] = value;
|
|
std::cout << name << " = " << value << std::endl;
|
|
}
|
|
} |