Add increment/decrement to safe

This commit is contained in:
Nathan Hourt 2015-05-01 16:17:49 -04:00
parent 80de0987d7
commit 2195f191e4

View file

@ -41,6 +41,11 @@ namespace fc {
return safe(-value);
}
safe operator++(int) { safe bak = *this; *this += 1; return bak; }
safe& operator++() { return *this += 1; }
safe operator--(int) { safe bak = *this; *this -= 1; return bak; }
safe& operator--() { return *this -= 1; }
friend safe operator - ( const safe& a, const safe& b )
{
safe tmp(a); tmp -= b; return tmp;