Implemented generic for loops
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -4,8 +4,6 @@
|
||||
|
||||
#include <memory>
|
||||
#include "../EvalValues/EvalValue.hpp"
|
||||
#include "../EvalValues/TableEvalValue.hpp"
|
||||
#include "../EvalValues/StringEvalValue.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
@@ -17,26 +15,6 @@ namespace Porygon::Evaluation{
|
||||
virtual void Reset() = 0;
|
||||
};
|
||||
|
||||
class TableKeyIterator : Iterator{
|
||||
_Rb_tree_const_iterator<pair<const Utilities::HashedString, shared_ptr<EvalValue>>> _iterator;
|
||||
_Rb_tree_const_iterator<pair<const Utilities::HashedString, shared_ptr<EvalValue>>> _end;
|
||||
public:
|
||||
TableKeyIterator(shared_ptr<TableEvalValue> table)
|
||||
: _iterator(table->GetTableIterator()), _end(table->GetTableIteratorEnd()){}
|
||||
|
||||
shared_ptr<EvalValue> GetCurrent() final{
|
||||
return make_shared<StringEvalValue>(*_iterator->first.GetString());
|
||||
}
|
||||
|
||||
bool MoveNext() final{
|
||||
std::advance(_iterator, 1);
|
||||
return _iterator != _end;
|
||||
}
|
||||
|
||||
void Reset(){
|
||||
throw EvaluationException("Can't reset table key iterator");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user