Merge pull request #6326 from ethereum/moveAppendSet

Add operator for move-append onto set.
This commit is contained in:
chriseth 2019-03-19 19:44:25 +01:00 committed by GitHub
commit 11198cd76a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,6 +55,13 @@ template <class T, class U> std::set<T>& operator+=(std::set<T>& _a, U const& _b
_a.insert(_b.begin(), _b.end()); _a.insert(_b.begin(), _b.end());
return _a; return _a;
} }
/// Concatenate the contents of a container onto a set, move variant.
template <class T, class U> std::set<T>& operator+=(std::set<T>& _a, U&& _b)
{
for (auto&& x: _b)
_a.insert(std::move(x));
return _a;
}
/// Concatenate two vectors of elements. /// Concatenate two vectors of elements.
template <class T> template <class T>
inline std::vector<T> operator+(std::vector<T> const& _a, std::vector<T> const& _b) inline std::vector<T> operator+(std::vector<T> const& _a, std::vector<T> const& _b)