]> granicus.if.org Git - clang/commitdiff
Add pre- and post-increment/decrement operators to CharUnits.
authorKen Dyck <kd@kendyck.com>
Sat, 19 Mar 2011 01:25:59 +0000 (01:25 +0000)
committerKen Dyck <kd@kendyck.com>
Sat, 19 Mar 2011 01:25:59 +0000 (01:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127937 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/CharUnits.h

index cf909e88220f8d70fde68e6c89f632d8ae5771ca..5bfa19dd7417ade6996d77aa520f42cd6ba21276 100644 (file)
@@ -70,10 +70,24 @@ namespace clang {
         Quantity += Other.Quantity;
         return *this;
       }
+      CharUnits& operator++ () {
+        ++Quantity;
+        return *this;
+      }
+      CharUnits operator++ (int) {
+        return CharUnits(Quantity++);
+      }
       CharUnits& operator-= (const CharUnits &Other) {
         Quantity -= Other.Quantity;
         return *this;
       }
+      CharUnits& operator-- () {
+        --Quantity;
+        return *this;
+      }
+      CharUnits operator-- (int) {
+        return CharUnits(Quantity--);
+      }
        
       // Comparison operators.
       bool operator== (const CharUnits &Other) const {