mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
add ostream to bytes for ease of development
Signed-off-by: VoR0220 <rj@erisindustries.com> fix up Signed-off-by: VoR0220 <rj@erisindustries.com>
This commit is contained in:
parent
b46a14f4a8
commit
9dda8f7d84
@ -135,6 +135,16 @@ inline u256 s2u(s256 _u)
|
|||||||
return u256(c_end + _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()
|
template <size_t n> inline u256 exp10()
|
||||||
{
|
{
|
||||||
return exp10<n - 1>() * u256(10);
|
return exp10<n - 1>() * u256(10);
|
||||||
|
Loading…
Reference in New Issue
Block a user