24 lines
569 B
C++
24 lines
569 B
C++
#pragma once
|
|
|
|
#include <chrono>
|
|
#include <list>
|
|
|
|
|
|
/**
|
|
* A simple list with additional stat data, such as the date of the latest modification
|
|
* @tparam T the type of elements in the list
|
|
*/
|
|
template<class T>
|
|
class StatList : public std::list<T> {
|
|
public:
|
|
StatList();
|
|
|
|
void push_back(const T& 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;
|
|
};
|