From 247cf58bfa348ba104afe9328945979c4b154e46 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Wed, 25 Feb 2009 23:42:31 -0400 Subject: [PATCH] Allow sequences to be rounded and unrounded The result is that every member of the sequence has the given operation applied. --- src/value.cc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/value.cc b/src/value.cc index e3f3f01b..94bcfb20 100644 --- a/src/value.cc +++ b/src/value.cc @@ -1282,6 +1282,12 @@ value_t value_t::rounded() const return as_amount().rounded(); case BALANCE: return as_balance().rounded(); + case SEQUENCE: { + value_t temp; + foreach (const value_t& value, as_sequence()) + temp.push_back(value.rounded()); + return temp; + } default: break; } @@ -1299,6 +1305,12 @@ value_t value_t::unrounded() const return as_amount().unrounded(); case BALANCE: return as_balance().unrounded(); + case SEQUENCE: { + value_t temp; + foreach (const value_t& value, as_sequence()) + temp.push_back(value.unrounded()); + return temp; + } default: break; }