From 9dda8f7d84d50a974b6de759a543f001803d9028 Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Thu, 17 Nov 2016 18:01:28 -0600 Subject: 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(+) (limited to 'libdevcore/Common.h') diff --git a/libdevcore/Common.h b/libdevcore/Common.h index d65cfeac..dababe79 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); -- cgit From 9869f1a78bff6b8d84ed0b08e7beb5d425fa5aad Mon Sep 17 00:00:00 2001 From: VoR0220 Date: Mon, 21 Nov 2016 13:53:53 -0600 Subject: convert individual numbers to hex Signed-off-by: VoR0220 --- libdevcore/Common.h | 1 + 1 file changed, 1 insertion(+) (limited to 'libdevcore/Common.h') diff --git a/libdevcore/Common.h b/libdevcore/Common.h index dababe79..225f38ac 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -138,6 +138,7 @@ inline u256 s2u(s256 _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(ss, ",")); std::string result = ss.str(); result.pop_back(); -- cgit