From 9dda8f7d84d50a974b6de759a543f001803d9028 Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Thu, 17 Nov 2016 18:01:28 -0600 Subject: [PATCH] add ostream to bytes for ease of development Signed-off-by: VoR0220 fix up Signed-off-by: VoR0220 --- libdevcore/Common.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libdevcore/Common.h b/libdevcore/Common.h index d65cfeacd..dababe79f 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -135,6 +135,16 @@ inline u256 s2u(s256 _u) return u256(c_end + _u); } +inline std::ostream& operator<<(std::ostream& os, bytes const& _bytes) +{ + std::ostringstream ss; + std::copy(_bytes.begin(), _bytes.end(), std::ostream_iterator(ss, ",")); + std::string result = ss.str(); + result.pop_back(); + os << "[" + result + "]"; + return os; +} + template inline u256 exp10() { return exp10() * u256(10);