diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION index fa2f140..dc838ba 100755 --- a/CRAN-SUBMISSION +++ b/CRAN-SUBMISSION @@ -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 diff --git a/src/appl-0.96/Core/SymbolSetIterator.h b/src/appl-0.96/Core/SymbolSetIterator.h index c20a478..e3e6bd1 100755 --- a/src/appl-0.96/Core/SymbolSetIterator.h +++ b/src/appl-0.96/Core/SymbolSetIterator.h @@ -1,84 +1,72 @@ -#ifndef SymbolSetIterator_H -#define SymbolSetIterator_H - -#include - -#include "Const.h" -using namespace std; -//using namespace momdp; -namespace momdp -{ -template class SymbolSet; - -template -class SymbolSetIterator: public iterator -{ - SymbolSet *parentSet; - int symbolID; - - -public: - SymbolSetIterator(SymbolSet *_parentSet, int _symbolID) - { - parentSet = _parentSet; - symbolID = _symbolID; - } - - SymbolSetIterator(const SymbolSetIterator& mit) - { - this->parentSet = mit.parentSet; - this->symbolID = mit.symbolID; - } - - SymbolSetIterator& 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 + +#include "Const.h" +using namespace std; +//using namespace momdp; + +namespace momdp +{ +template class SymbolSet; + +template +class SymbolSetIterator +{ + SymbolSet *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 *_parentSet, int _symbolID) + : parentSet(_parentSet), symbolID(_symbolID) {} + + SymbolSetIterator(const SymbolSetIterator& mit) + : parentSet(mit.parentSet), symbolID(mit.symbolID) {} + + SymbolSetIterator& operator++() + { + ++symbolID; + return *this; + } + + SymbolSetIterator operator++(int) + { + SymbolSetIterator 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