diff options
Diffstat (limited to 'src/amount.h')
-rw-r--r-- | src/amount.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/amount.h b/src/amount.h index f3109f33..f90a5e4c 100644 --- a/src/amount.h +++ b/src/amount.h @@ -73,7 +73,7 @@ DECLARE_EXCEPTION(amount_error); : public ordered_field_operators<amount_t, ordered_field_operators<amount_t, long, ordered_field_operators<amount_t, unsigned long, - ordered_field_operators<amount_t, double > > > > + ordered_field_operators<amount_t, double> > > > { public: class bigint_t; @@ -137,9 +137,19 @@ public: // comparisons between amounts int compare(const amount_t& amt) const; bool operator==(const amount_t& amt) const; - bool operator<(const amount_t& amt) const { + + template <typename T> + bool operator==(const T& val) const { + return compare(val) == 0; + } + template <typename T> + bool operator<(const T& amt) const { return compare(amt) < 0; } + template <typename T> + bool operator>(const T& amt) const { + return compare(amt) > 0; + } // in-place arithmetic amount_t& operator+=(const amount_t& amt); |