diff options
Diffstat (limited to 'libdevcore')
-rw-r--r-- | libdevcore/Common.h | 3 | ||||
-rw-r--r-- | libdevcore/CommonData.h | 3 | ||||
-rw-r--r-- | libdevcore/FixedHash.h | 4 |
3 files changed, 6 insertions, 4 deletions
diff --git a/libdevcore/Common.h b/libdevcore/Common.h index c5b09a80..9d6dd408 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -44,7 +44,6 @@ #include <unordered_set> #include <functional> #include <string> -#include <chrono> #if defined(__GNUC__) #pragma warning(push) @@ -158,7 +157,7 @@ template <> inline u256 exp10<0>() class ScopeGuard { public: - ScopeGuard(std::function<void(void)> _f): m_f(_f) {} + explicit ScopeGuard(std::function<void(void)> _f): m_f(_f) {} ~ScopeGuard() { m_f(); } private: diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h index 6f40d7be..0321011e 100644 --- a/libdevcore/CommonData.h +++ b/libdevcore/CommonData.h @@ -184,7 +184,8 @@ template <class T> inline std::vector<T> operator+(std::vector<T> const& _a, std::vector<T> const& _b) { std::vector<T> ret(_a); - return ret += _b; + ret += _b; + return ret; } template <class T, class V> diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index 5b1c7acf..141e9ffd 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -27,6 +27,7 @@ #include <cstdint> #include <algorithm> #include <boost/functional/hash.hpp> +#include <boost/io/ios_state.hpp> #include "CommonData.h" namespace dev @@ -59,7 +60,7 @@ public: enum ConstructFromHashType { AlignLeft, AlignRight, FailIfDifferent }; /// Construct an empty hash. - FixedHash() { m_data.fill(0); } + explicit FixedHash() { m_data.fill(0); } /// Construct from another hash, filling with zeroes or cropping as necessary. template <unsigned M> explicit FixedHash(FixedHash<M> const& _h, ConstructFromHashType _t = AlignLeft) { m_data.fill(0); unsigned c = std::min(M, N); for (unsigned i = 0; i < c; ++i) m_data[_t == AlignRight ? N - 1 - i : i] = _h[_t == AlignRight ? M - 1 - i : i]; } @@ -224,6 +225,7 @@ template<> inline size_t FixedHash<32>::hash::operator()(FixedHash<32> const& va template <unsigned N> inline std::ostream& operator<<(std::ostream& _out, FixedHash<N> const& _h) { + boost::io::ios_all_saver guard(_out); _out << std::noshowbase << std::hex << std::setfill('0'); for (unsigned i = 0; i < N; ++i) _out << std::setw(2) << (int)_h[i]; |