X-Git-Url: http://g0dil.de/git?p=senf.git;a=blobdiff_plain;f=senf%2FUtils%2FRestrictedInt.hh;fp=senf%2FUtils%2FRestrictedInt.hh;h=003a85051719cebdff8e9e51f505b3143d703125;hp=08714ac896dcccdbb67157a16dc1e149bfd421dd;hb=114131e8774ab05964646992613a98dcedf92434;hpb=728c6fbeb525a2b48b927ebf17cc06ca943583b2
diff --git a/senf/Utils/RestrictedInt.hh b/senf/Utils/RestrictedInt.hh
index 08714ac..003a850 100644
--- a/senf/Utils/RestrictedInt.hh
+++ b/senf/Utils/RestrictedInt.hh
@@ -105,41 +105,48 @@ namespace senf {
bool boolean_test() const
{ return value_; }
- RestrictedInt operator*(int i) const
- { return RestrictedInt(value_ * i); }
-
- RestrictedInt operator/(int i) const
- { return RestrictedInt(value_ / i); }
-
- bool operator>(int i) const
- { return value_ > i; }
-
- bool operator>=(int i) const
- { return value_ >= i; }
+ private:
+ Base value_;
+ };
- bool operator<(int i) const
- { return value_ < i; }
- bool operator<=(int i) const
- { return value_ <= i; }
+ template
+ RestrictedInt operator*(OtherType a, RestrictedInt b)
+ {
+ return RestrictedInt( a * b.value());
+ }
- bool operator==(int i) const
- { return value_ == i; }
+ template
+ RestrictedInt operator*(RestrictedInt a, OtherType b)
+ {
+ return RestrictedInt( a.value() * b);
+ }
- bool operator!=(int i) const
- { return value_ != i; }
+ template
+ RestrictedInt operator/(OtherType a, RestrictedInt b)
+ {
+ return RestrictedInt( a / b.value());
+ }
- private:
- Base value_;
- };
+ template
+ RestrictedInt operator/(RestrictedInt a, OtherType b)
+ {
+ return RestrictedInt( a.value() / b);
+ }
template
std::ostream & operator<<(std::ostream & os, RestrictedInt value)
- { os << value.value(); return os; }
+ {
+ os << value.value();
+ return os;
+ }
template
std::istream & operator>>(std::istream & is, RestrictedInt & value)
- { Base v; is >> v; value = RestrictedInt(v); return is; }
+ {
+ Base v; is >> v; value = RestrictedInt(v);
+ return is;
+ }
}