aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore/Common.h
diff options
context:
space:
mode:
Diffstat (limited to 'libdevcore/Common.h')
-rw-r--r--libdevcore/Common.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/libdevcore/Common.h b/libdevcore/Common.h
index 43ae7162..225f38ac 100644
--- a/libdevcore/Common.h
+++ b/libdevcore/Common.h
@@ -70,7 +70,6 @@
#include "vector_ref.h"
-// CryptoPP defines byte in the global namespace, so must we.
using byte = uint8_t;
// Quote a given token stream to turn it into a string.
@@ -136,6 +135,17 @@ inline u256 s2u(s256 _u)
return u256(c_end + _u);
}
+inline std::ostream& operator<<(std::ostream& os, bytes const& _bytes)
+{
+ std::ostringstream ss;
+ ss << std::hex;
+ std::copy(_bytes.begin(), _bytes.end(), std::ostream_iterator<int>(ss, ","));
+ std::string result = ss.str();
+ result.pop_back();
+ os << "[" + result + "]";
+ return os;
+}
+
template <size_t n> inline u256 exp10()
{
return exp10<n - 1>() * u256(10);