summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/util.h b/util.h
index 842879e5..dc14547a 100644
--- a/util.h
+++ b/util.h
@@ -96,4 +96,13 @@ std::string abbreviate(const std::string& str, unsigned int width,
elision_style_t elision_style = TRUNCATE_TRAILING,
const bool is_account = false, int abbrev_length = 2);
+static inline const
+std::string& either_or(const std::string& first, const std::string& second)
+{
+ if (first.empty())
+ return second;
+ else
+ return first;
+}
+
#endif // _UTIL_H