mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #1393 from VoR0220/giveBytesOstream
add ostream to bytes for ease of development
This commit is contained in:
commit
a7c2509adf
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user