From 2195f191e45fa1ac00a55dc9b00db1e7dab8365f Mon Sep 17 00:00:00 2001 From: Nathan Hourt Date: Fri, 1 May 2015 16:17:49 -0400 Subject: [PATCH] Add increment/decrement to safe --- include/fc/safe.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/fc/safe.hpp b/include/fc/safe.hpp index 44effd6..2482621 100644 --- a/include/fc/safe.hpp +++ b/include/fc/safe.hpp @@ -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;