prime/include/Kyoto/TReservedAverage.hpp

29 lines
663 B
C++
Raw Normal View History

#ifndef _TRESERVEDAVERAGE
#define _TRESERVEDAVERAGE
#include "types.h"
2022-10-04 00:00:46 +00:00
#include "Kyoto/TAverage.hpp"
#include "rstl/optional_object.hpp"
#include "rstl/reserved_vector.hpp"
template < typename T, int N >
2022-10-19 22:29:03 +00:00
class TReservedAverage : public rstl::reserved_vector< T, N > {
public:
TReservedAverage() {}
TReservedAverage(const T& value) {
// resize(value, N); TODO
}
void AddValue(const T& value) {
2022-10-21 01:32:04 +00:00
this->push_back(value);
for (int i = this->size() - 1; i > 0; --i) {
this->operator[](i) = this->operator[](i - 1);
}
2022-10-21 01:32:04 +00:00
this->operator[](0) = value;
}
rstl::optional_object< T > GetAverage() const;
};
#endif // _TRESERVEDAVERAGE