Allow sequences to be rounded and unrounded
The result is that every member of the sequence has the given operation applied.
This commit is contained in:
parent
55a6d588ff
commit
247cf58bfa
1 changed files with 12 additions and 0 deletions
12
src/value.cc
12
src/value.cc
|
|
@ -1282,6 +1282,12 @@ value_t value_t::rounded() const
|
||||||
return as_amount().rounded();
|
return as_amount().rounded();
|
||||||
case BALANCE:
|
case BALANCE:
|
||||||
return as_balance().rounded();
|
return as_balance().rounded();
|
||||||
|
case SEQUENCE: {
|
||||||
|
value_t temp;
|
||||||
|
foreach (const value_t& value, as_sequence())
|
||||||
|
temp.push_back(value.rounded());
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1299,6 +1305,12 @@ value_t value_t::unrounded() const
|
||||||
return as_amount().unrounded();
|
return as_amount().unrounded();
|
||||||
case BALANCE:
|
case BALANCE:
|
||||||
return as_balance().unrounded();
|
return as_balance().unrounded();
|
||||||
|
case SEQUENCE: {
|
||||||
|
value_t temp;
|
||||||
|
foreach (const value_t& value, as_sequence())
|
||||||
|
temp.push_back(value.unrounded());
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue