diff --git a/src/ripple/shamap/SHAMap.h b/src/ripple/shamap/SHAMap.h index 104d06015..ba469fa59 100644 --- a/src/ripple/shamap/SHAMap.h +++ b/src/ripple/shamap/SHAMap.h @@ -138,6 +138,7 @@ public: bool hasItem (uint256 const& id) const; bool delItem (uint256 const& id); bool addItem (SHAMapItem const& i, bool isTransaction, bool hasMeta); + bool addItem (SHAMapItem&& i, bool isTransaction, bool hasMeta); uint256 getHash () const; // save a copy if you have a temporary anyway diff --git a/src/ripple/shamap/SHAMapItem.h b/src/ripple/shamap/SHAMapItem.h index e866b977d..8365d3c8b 100644 --- a/src/ripple/shamap/SHAMapItem.h +++ b/src/ripple/shamap/SHAMapItem.h @@ -40,6 +40,7 @@ private: public: SHAMapItem (uint256 const& tag, Blob const & data); SHAMapItem (uint256 const& tag, Serializer const& s); + SHAMapItem (uint256 const& tag, Serializer&& s); Slice slice() const; diff --git a/src/ripple/shamap/impl/SHAMap.cpp b/src/ripple/shamap/impl/SHAMap.cpp index a6d7f874e..a743aef62 100644 --- a/src/ripple/shamap/impl/SHAMap.cpp +++ b/src/ripple/shamap/impl/SHAMap.cpp @@ -798,6 +798,13 @@ bool SHAMap::addItem (const SHAMapItem& i, bool isTransaction, bool hasMetaData) return addGiveItem(std::make_shared(i), isTransaction, hasMetaData); } +bool +SHAMap::addItem(SHAMapItem&& i, bool isTransaction, bool hasMetaData) +{ + return addGiveItem(std::make_shared(std::move(i)), + isTransaction, hasMetaData); +} + uint256 SHAMap::getHash () const { diff --git a/src/ripple/shamap/impl/SHAMapItem.cpp b/src/ripple/shamap/impl/SHAMapItem.cpp index ce1e90a67..f7badf016 100644 --- a/src/ripple/shamap/impl/SHAMapItem.cpp +++ b/src/ripple/shamap/impl/SHAMapItem.cpp @@ -37,4 +37,10 @@ SHAMapItem::SHAMapItem (uint256 const& tag, const Serializer& data) { } +SHAMapItem::SHAMapItem (uint256 const& tag, Serializer&& data) + : tag_ (tag) + , data_(std::move(data.modData())) +{ +} + } // ripple