From 557ab32d30bcca3622e06a6809a541a015e84aa3 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 30 Jan 2019 11:09:08 -0800 Subject: Expose a new utility function for balances: sorted_amounts --- src/balance.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/balance.h') diff --git a/src/balance.h b/src/balance.h index 8e773fc5..b9c9c2c8 100644 --- a/src/balance.h +++ b/src/balance.h @@ -81,6 +81,7 @@ class balance_t { public: typedef std::map amounts_map; + typedef std::vector amounts_array; amounts_map amounts; @@ -528,6 +529,12 @@ public: */ balance_t strip_annotations(const keep_details_t& what_to_keep) const; + /** + * Given a balance, insert a commodity-wise sort of the amounts into the + * given amounts_array. + */ + void sorted_amounts(amounts_array& sorted) const; + /** * Iteration primitives. `map_sorted_amounts' allows one to visit * each amount in balance in the proper order for displaying to the -- cgit v1.2.3