Add BigNum to stringBuilder output operator.

GitOrigin-RevId: 6ba1beeccb1849a163e3e0cfc978d573f80a9dae
This commit is contained in:
levlam 2018-08-10 02:36:05 +03:00
parent f92e25fcd9
commit 6c1408565e
2 changed files with 7 additions and 0 deletions

View File

@ -254,5 +254,9 @@ int BigNum::compare(const BigNum &a, const BigNum &b) {
return BN_cmp(a.impl_->big_num, b.impl_->big_num); return BN_cmp(a.impl_->big_num, b.impl_->big_num);
} }
StringBuilder &operator<<(StringBuilder &sb, const BigNum &bn) {
return sb << bn.to_decimal();
}
} // namespace td } // namespace td
#endif #endif

View File

@ -12,6 +12,7 @@
#include "td/utils/Slice.h" #include "td/utils/Slice.h"
#include "td/utils/Status.h" #include "td/utils/Status.h"
#include "td/utils/StringBuilder.h"
namespace td { namespace td {
@ -106,6 +107,8 @@ class BigNum {
explicit BigNum(unique_ptr<Impl> &&impl); explicit BigNum(unique_ptr<Impl> &&impl);
}; };
StringBuilder &operator<<(StringBuilder &sb, const BigNum &bn);
} // namespace td } // namespace td
#endif #endif