Skip to content

Commit

Permalink
🤖
Browse files Browse the repository at this point in the history
  • Loading branch information
cboettig committed Jun 24, 2024
1 parent 8b21a6b commit d94227c
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 87 deletions.
6 changes: 3 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Version: 0.6.14
Date: 2023-01-09 17:08:17 UTC
SHA: 65b442c3e8df9be13917e8f8ce926ae8343929cc
Version: 0.6.15
Date: 2024-06-23 22:33:39 UTC
SHA: 8b21a6bee9209be3ee5cd45d9129007755e7c4ce
156 changes: 72 additions & 84 deletions src/appl-0.96/Core/SymbolSetIterator.h
Original file line number Diff line number Diff line change
@@ -1,84 +1,72 @@
#ifndef SymbolSetIterator_H
#define SymbolSetIterator_H

#include <iterator>

#include "Const.h"
using namespace std;
//using namespace momdp;
namespace momdp
{
template <typename T> class SymbolSet;

template <typename T>
class SymbolSetIterator: public iterator<input_iterator_tag, T>
{
SymbolSet<T> *parentSet;
int symbolID;


public:
SymbolSetIterator(SymbolSet<T> *_parentSet, int _symbolID)
{
parentSet = _parentSet;
symbolID = _symbolID;
}

SymbolSetIterator(const SymbolSetIterator& mit)
{
this->parentSet = mit.parentSet;
this->symbolID = mit.symbolID;
}

SymbolSetIterator<T>& operator++()
{
++symbolID;
return *this;
}

void operator++(int)
{
symbolID++;
}

bool operator==(const SymbolSetIterator& rhs)
{
if(parentSet == rhs.parentSet && symbolID == rhs.symbolID)
{
return true;
}
return false;
}

bool operator!=(const SymbolSetIterator& rhs)
{
if(parentSet != rhs.parentSet || symbolID != rhs.symbolID)
{
return true;
}
return false;
}

int operator*()
{
return symbolID;
}

T& value()
{
return parentSet->getSymbol(symbolID);
}
int index()
{
return symbolID;
}

};

}


#endif



// code edit assisted by ChatGPT 2024-06-24
#ifndef SymbolSetIterator_H
#define SymbolSetIterator_H

#include <iterator>

#include "Const.h"
using namespace std;
//using namespace momdp;

namespace momdp
{
template <typename T> class SymbolSet;

template <typename T>
class SymbolSetIterator
{
SymbolSet<T> *parentSet;
int symbolID;
public:
using iterator_category = input_iterator_tag;
using value_type = T;
using difference_type = ptrdiff_t;
using pointer = T*;
using reference = T&;

SymbolSetIterator(SymbolSet<T> *_parentSet, int _symbolID)
: parentSet(_parentSet), symbolID(_symbolID) {}

SymbolSetIterator(const SymbolSetIterator& mit)
: parentSet(mit.parentSet), symbolID(mit.symbolID) {}

SymbolSetIterator<T>& operator++()
{
++symbolID;
return *this;
}

SymbolSetIterator<T> operator++(int)
{
SymbolSetIterator<T> tmp(*this);
++symbolID;
return tmp;
}

bool operator==(const SymbolSetIterator& rhs) const
{
return parentSet == rhs.parentSet && symbolID == rhs.symbolID;
}

bool operator!=(const SymbolSetIterator& rhs) const
{
return !(*this == rhs);
}

int operator*() const
{
return symbolID;
}

T& value() const
{
return parentSet->getSymbol(symbolID);
}

int index() const
{
return symbolID;
}
};
}
#endif

0 comments on commit d94227c

Please sign in to comment.