mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-16 13:01:19 +02:00
Move CAmountMap to amount.h
This commit is contained in:
parent
2f7a9a5846
commit
fa0a86fb74
4 changed files with 48 additions and 49 deletions
|
|
@ -41,3 +41,37 @@ std::string CFeeRate::ToString() const
|
|||
{
|
||||
return strprintf("%d.%08d %s/kB", nSatoshisPerK / COIN, nSatoshisPerK % COIN, CURRENCY_UNIT);
|
||||
}
|
||||
|
||||
CAmountMap& operator+=(CAmountMap& a, const CAmountMap& b)
|
||||
{
|
||||
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
|
||||
a[it->first] += it->second;
|
||||
return a;
|
||||
}
|
||||
|
||||
CAmountMap& operator-=(CAmountMap& a, const CAmountMap& b)
|
||||
{
|
||||
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
|
||||
a[it->first] -= it->second;
|
||||
return a;
|
||||
}
|
||||
|
||||
CAmountMap operator+(const CAmountMap& a, const CAmountMap& b)
|
||||
{
|
||||
CAmountMap c;
|
||||
for(std::map<CAssetID, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it)
|
||||
c[it->first] += it->second;
|
||||
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
|
||||
c[it->first] += it->second;
|
||||
return c;
|
||||
}
|
||||
|
||||
CAmountMap operator-(const CAmountMap& a, const CAmountMap& b)
|
||||
{
|
||||
CAmountMap c;
|
||||
for(std::map<CAssetID, CAmount>::const_iterator it = a.begin(); it != a.end(); ++it)
|
||||
c[it->first] += it->second;
|
||||
for(std::map<CAssetID, CAmount>::const_iterator it = b.begin(); it != b.end(); ++it)
|
||||
c[it->first] -= it->second;
|
||||
return c;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue