mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Make the data of a SHAMap const:
* Hold a shared_ptr<SHAMapItem const> instead of a shared_ptr<SHAMapItem>. * Compiler helps us enforce data immutability. * Make SHAMapAbstractNode::addRaw const Conflicts: src/ripple/app/ledger/Ledger.cpp src/ripple/app/ledger/Ledger.h src/ripple/app/ledger/LedgerHistory.cpp src/ripple/app/ledger/LedgerToJson.h
This commit is contained in:
committed by
Vinnie Falco
parent
d468deee12
commit
1e6111c09c
@@ -29,7 +29,7 @@ namespace ripple {
|
||||
static const uint256 uZero;
|
||||
|
||||
static bool visitLeavesHelper (
|
||||
std::function <void (std::shared_ptr<SHAMapItem> const&)> const& function,
|
||||
std::function <void (std::shared_ptr<SHAMapItem const> const&)> const& function,
|
||||
SHAMapAbstractNode& node)
|
||||
{
|
||||
// Adapt visitNodes to visitLeaves
|
||||
@@ -41,7 +41,7 @@ static bool visitLeavesHelper (
|
||||
|
||||
void
|
||||
SHAMap::visitLeaves(
|
||||
std::function<void(std::shared_ptr<SHAMapItem> const& item)> const& leafFunction) const
|
||||
std::function<void(std::shared_ptr<SHAMapItem const> const& item)> const& leafFunction) const
|
||||
{
|
||||
visitNodes (std::bind (visitLeavesHelper,
|
||||
std::cref (leafFunction), std::placeholders::_1));
|
||||
|
||||
Reference in New Issue
Block a user