aboutsummaryrefslogtreecommitdiffstats
path: root/libdevcore
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-11-23 21:57:02 +0800
committerGitHub <noreply@github.com>2016-11-23 21:57:02 +0800
commita7c2509adfe57f106cb87ed024925751732b5412 (patch)
tree6f776593a700453347f8f71c6de9ee5017d100c4 /libdevcore
parentb1d2d07e605f514f7ad4aab25b3899d0ddb0d360 (diff)
parent9869f1a78bff6b8d84ed0b08e7beb5d425fa5aad (diff)
downloaddexon-solidity-a7c2509adfe57f106cb87ed024925751732b5412.tar.gz
dexon-solidity-a7c2509adfe57f106cb87ed024925751732b5412.tar.zst
dexon-solidity-a7c2509adfe57f106cb87ed024925751732b5412.zip
Merge pull request #1393 from VoR0220/giveBytesOstream
add ostream to bytes for ease of development
Diffstat (limited to 'libdevcore')
-rw-r--r--libdevcore/Common.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/libdevcore/Common.h b/libdevcore/Common.h
index d65cfeac..225f38ac 100644
--- a/libdevcore/Common.h
+++ b/libdevcore/Common.h
@@ -135,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);