Skip to content

Commit

Permalink
add ostream to bytes for ease of development
Browse files Browse the repository at this point in the history
Signed-off-by: VoR0220 <[email protected]>

fix up

Signed-off-by: VoR0220 <[email protected]>
  • Loading branch information
VoR0220 committed Nov 18, 2016
1 parent b46a14f commit 9dda8f7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libdevcore/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<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);
Expand Down

0 comments on commit 9dda8f7

Please sign in to comment.