M2-PT-DRP/source/utils/StatList.hpp

30 lines
No EOL
612 B
C++

#pragma once
#include <chrono>
#include <list>
namespace drp::util {
/**
* A simple list with additional stat data, such as the date of the latest modification
* @tparam Value the type of elements in the list
*/
template<class Value>
class StatList : public std::list<Value> {
public:
StatList();
void push_back(const Value& value);
void pop_back();
[[nodiscard]] std::chrono::time_point<std::chrono::high_resolution_clock> getModificationTime() const;
private:
void updateModificationTime();
std::chrono::time_point<std::chrono::high_resolution_clock> modificationTime;
};
}