Add operator+(int) and operator-(other)

This commit is contained in:
Andreas Fabri 2024-12-18 11:07:13 +00:00
parent 99f514122b
commit 000bae9889
1 changed files with 19 additions and 0 deletions

View File

@ -93,6 +93,25 @@ public:
return tmp; return tmp;
} }
Self operator+(std::size_t offset) const
{
// todo: make this a O(1) time operation
Self res(*this);
for(int i=0;i<offset;++i){
++res;
}
return res;
}
std::size_t operator-(Self other) const
{
// todo: make this a O(1) time operation
std::size_t res = 0;
while(other != *this){
++res;
}
return res;
}
reference operator*() const reference operator*() const
{ {