2022-04-10 00:17:06 +00:00
|
|
|
#ifndef _TRESERVEDAVERAGE_HPP
|
|
|
|
#define _TRESERVEDAVERAGE_HPP
|
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2022-10-04 00:00:46 +00:00
|
|
|
#include "Kyoto/TAverage.hpp"
|
|
|
|
|
2022-04-10 00:17:06 +00:00
|
|
|
#include "rstl/optional_object.hpp"
|
|
|
|
#include "rstl/reserved_vector.hpp"
|
|
|
|
|
2022-09-05 04:01:13 +00:00
|
|
|
template < typename T, int N >
|
2022-04-10 00:17:06 +00:00
|
|
|
class TReservedAverage : rstl::reserved_vector< T, N > {
|
|
|
|
public:
|
2022-09-13 04:26:54 +00:00
|
|
|
TReservedAverage() {}
|
2022-04-10 00:17:06 +00:00
|
|
|
TReservedAverage(const T& value) {
|
|
|
|
// resize(value, N); TODO
|
|
|
|
}
|
|
|
|
void AddValue(const T& value) {
|
|
|
|
push_back(value);
|
2022-09-05 04:01:13 +00:00
|
|
|
for (int i = size() - 1; i > 0; --i) {
|
2022-04-10 00:17:06 +00:00
|
|
|
operator[](i) = operator[](i - 1);
|
|
|
|
}
|
|
|
|
operator[](0) = value;
|
|
|
|
}
|
|
|
|
rstl::optional_object< T > GetAverage() const;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|