Add pre- and post-increment/decrement operators to CharUnits.

llvm-svn: 127937
This commit is contained in:
Ken Dyck 2011-03-19 01:25:59 +00:00
parent 5c07daaa1d
commit 54d4d9fb19
1 changed files with 14 additions and 0 deletions

View 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 {