Add increment/decrement to safe
This commit is contained in:
parent
80de0987d7
commit
2195f191e4
1 changed files with 5 additions and 0 deletions
|
|
@ -41,6 +41,11 @@ namespace fc {
|
||||||
return safe(-value);
|
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 )
|
friend safe operator - ( const safe& a, const safe& b )
|
||||||
{
|
{
|
||||||
safe tmp(a); tmp -= b; return tmp;
|
safe tmp(a); tmp -= b; return tmp;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue