summaryrefslogtreecommitdiff
path: root/src/value.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/value.h')
-rw-r--r--src/value.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/value.h b/src/value.h
index 7c82efaf..8d638657 100644
--- a/src/value.h
+++ b/src/value.h
@@ -923,6 +923,15 @@ inline string value_context(const value_t& val) {
return buf.str();
}
+template <typename T>
+inline value_t& add_or_set_value(value_t& lhs, const T& rhs) {
+ if (lhs.is_null())
+ lhs = rhs;
+ else
+ lhs += rhs;
+ return lhs;
+}
+
} // namespace ledger
#endif // _VALUE_H