|
@@ -1,11 +1,15 @@
|
|
|
#include "lastseen.h"
|
|
|
|
|
|
-LastSeen::LastSeen(int max) {
|
|
|
+
|
|
|
+
|
|
|
+LastSeen::LastSeen(int max) : tracker(max, -1) {
|
|
|
this->max = max;
|
|
|
|
|
|
tracker.reserve(max);
|
|
|
+
|
|
|
while ((int)tracker.size() < max)
|
|
|
tracker.insert(tracker.begin(), -1);
|
|
|
+ */
|
|
|
}
|
|
|
|
|
|
|
|
@@ -15,14 +19,12 @@ int LastSeen::bestsize(int max_items) {
|
|
|
}
|
|
|
*/
|
|
|
|
|
|
-int LastSeen::getmax(void) {
|
|
|
- return this->max;
|
|
|
-}
|
|
|
+int LastSeen::getmax(void) { return this->max; }
|
|
|
|
|
|
-LastSeen::~LastSeen() { };
|
|
|
+LastSeen::~LastSeen(){};
|
|
|
|
|
|
bool LastSeen::seen_before(int this_one) {
|
|
|
- for (auto it = this->tracker.begin(); it != this->tracker.end(); ++it ) {
|
|
|
+ for (auto it = this->tracker.begin(); it != this->tracker.end(); ++it) {
|
|
|
if (*it == this_one)
|
|
|
return true;
|
|
|
}
|
|
@@ -33,6 +35,4 @@ bool LastSeen::seen_before(int this_one) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
-int LastSeen::best_guess(int max) {
|
|
|
- return max / 2;
|
|
|
-}
|
|
|
+int LastSeen::best_guess(int max) { return max / 2; }
|