Fixes compilation with MSVC.

This commit is contained in:
Christian Parpart 2020-08-19 13:11:39 +02:00
parent 04a599049f
commit ab56c85915

View File

@ -37,7 +37,10 @@
#include <utility>
#include <type_traits>
/// Operators need to stay in the global namespace.
namespace std
{
/// Operator overloads for STL containers should be in std namespace for ADL to work properly.
/// Concatenate the contents of a container onto a vector
template <class T, class U> std::vector<T>& operator+=(std::vector<T>& _a, U& _b)
@ -78,6 +81,7 @@ template <class U, class... T> std::set<T...>& operator+=(std::set<T...>& _a, U&
_a.insert(std::move(x));
return _a;
}
/// Concatenate two vectors of elements.
template <class T>
inline std::vector<T> operator+(std::vector<T> const& _a, std::vector<T> const& _b)
@ -86,6 +90,7 @@ inline std::vector<T> operator+(std::vector<T> const& _a, std::vector<T> const&
ret += _b;
return ret;
}
/// Concatenate two vectors of elements, moving them.
template <class T>
inline std::vector<T> operator+(std::vector<T>&& _a, std::vector<T>&& _b)
@ -97,6 +102,7 @@ inline std::vector<T> operator+(std::vector<T>&& _a, std::vector<T>&& _b)
ret += std::move(_b);
return ret;
}
/// Concatenate something to a sets of elements.
template <class T, class U>
inline std::set<T> operator+(std::set<T> const& _a, U&& _b)
@ -105,6 +111,7 @@ inline std::set<T> operator+(std::set<T> const& _a, U&& _b)
ret += std::forward<U>(_b);
return ret;
}
/// Concatenate something to a sets of elements, move variant.
template <class T, class U>
inline std::set<T> operator+(std::set<T>&& _a, U&& _b)
@ -140,6 +147,8 @@ inline std::multiset<T...>& operator-=(std::multiset<T...>& _a, C const& _b)
return _a;
}
} // end namespace std
namespace solidity::util
{