diff options
Diffstat (limited to 'src/amount.h')
-rw-r--r-- | src/amount.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/amount.h b/src/amount.h index 10e83552..cd77a79a 100644 --- a/src/amount.h +++ b/src/amount.h @@ -544,6 +544,15 @@ public: *this = 0L; commodity_ = &comm; } + amount_t with_commodity(const commodity_t& comm) const { + if (commodity_ == &comm) { + return *this; + } else { + amount_t tmp(*this); + tmp.set_commodity(const_cast<commodity_t&>(comm)); + return tmp; + } + } void clear_commodity() { commodity_ = NULL; } |