-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
75 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |