1#ifndef EXPIRING_TEMPORAL_VECTOR_HPP
2#define EXPIRING_TEMPORAL_VECTOR_HPP
6#include <unordered_map>
15 using Clock = std::chrono::steady_clock;
44 typename std::vector<T>::iterator
begin();
45 typename std::vector<T>::iterator
end();
51 void clean_expired_elements();
53 std::vector<T> elements_;
54 std::unordered_map<int, TimePoint> timestamps_;
55 std::chrono::seconds time_limit_;
59#include "expiring_temporal_vector.tpp"
std::vector< T > get_elements_since(TimePoint time)
Get all elements with timestamps greater than or equal to the specified time.
std::vector< T >::iterator end()
std::vector< T > get_elements()
Get all elements currently in the vector.
Clock::time_point TimePoint
Definition expiring_temporal_vector.hpp:16
void push_back(const T &element)
Add an element to the vector with the current timestamp.
ExpiringTemporalVector(int time_limit_seconds)
Constructor to initialize the expiring temporal vector with a time limit.
std::chrono::steady_clock Clock
Definition expiring_temporal_vector.hpp:15
std::vector< T >::iterator begin()