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:
Howard Hinnant
2015-06-16 14:03:52 -04:00
committed by Vinnie Falco
parent d468deee12
commit 1e6111c09c
13 changed files with 121 additions and 99 deletions

View File

@@ -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));