summaryrefslogtreecommitdiff
path: root/value.h
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2004-09-14 05:05:56 -0400
committerJohn Wiegley <johnw@newartisans.com>2004-09-14 05:05:56 -0400
commitbd72c0cf908492abb99a1419f7f8136729747061 (patch)
tree2ee9bfbf02c94fa9fdf4cd344901e4cc48e65a0a /value.h
parenta013b520ba151b9da3adec97d124676a96741b04 (diff)
downloadfork-ledger-bd72c0cf908492abb99a1419f7f8136729747061.tar.gz
fork-ledger-bd72c0cf908492abb99a1419f7f8136729747061.tar.bz2
fork-ledger-bd72c0cf908492abb99a1419f7f8136729747061.zip
added more math operators for value_t types
Diffstat (limited to 'value.h')
-rw-r--r--value.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/value.h b/value.h
index 617b5fb7..819f985f 100644
--- a/value.h
+++ b/value.h
@@ -250,6 +250,23 @@ class value_t
};
template <typename T>
+value_t operator+(const T& value, const value_t& obj) {
+ return value_t(value) + obj;
+}
+template <typename T>
+value_t operator-(const T& value, const value_t& obj) {
+ return value_t(value) - obj;
+}
+template <typename T>
+value_t operator*(const T& value, const value_t& obj) {
+ return value_t(value) * obj;
+}
+template <typename T>
+value_t operator/(const T& value, const value_t& obj) {
+ return value_t(value) / obj;
+}
+
+template <typename T>
value_t::operator T() const
{
switch (type) {