Simplify and optimize character printing in format.h.
This commit is contained in:
parent
7532774bf0
commit
572455ea54
@ -216,7 +216,7 @@ struct Array {
|
|||||||
template <class ArrayT>
|
template <class ArrayT>
|
||||||
StringBuilder &operator<<(StringBuilder &stream, const Array<ArrayT> &array) {
|
StringBuilder &operator<<(StringBuilder &stream, const Array<ArrayT> &array) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
stream << Slice("{");
|
stream << '{';
|
||||||
for (auto &x : array.ref) {
|
for (auto &x : array.ref) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
stream << Slice(", ");
|
stream << Slice(", ");
|
||||||
@ -224,12 +224,12 @@ StringBuilder &operator<<(StringBuilder &stream, const Array<ArrayT> &array) {
|
|||||||
stream << x;
|
stream << x;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
return stream << Slice("}");
|
return stream << '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StringBuilder &operator<<(StringBuilder &stream, const Array<vector<bool>> &array) {
|
inline StringBuilder &operator<<(StringBuilder &stream, const Array<vector<bool>> &array) {
|
||||||
bool first = true;
|
bool first = true;
|
||||||
stream << Slice("{");
|
stream << '{';
|
||||||
for (bool x : array.ref) {
|
for (bool x : array.ref) {
|
||||||
if (!first) {
|
if (!first) {
|
||||||
stream << Slice(", ");
|
stream << Slice(", ");
|
||||||
@ -237,7 +237,7 @@ inline StringBuilder &operator<<(StringBuilder &stream, const Array<vector<bool>
|
|||||||
stream << x;
|
stream << x;
|
||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
return stream << Slice("}");
|
return stream << '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ArrayT>
|
template <class ArrayT>
|
||||||
@ -254,7 +254,7 @@ struct Tagged {
|
|||||||
|
|
||||||
template <class ValueT>
|
template <class ValueT>
|
||||||
StringBuilder &operator<<(StringBuilder &stream, const Tagged<ValueT> &tagged) {
|
StringBuilder &operator<<(StringBuilder &stream, const Tagged<ValueT> &tagged) {
|
||||||
return stream << "[" << tagged.tag << ":" << tagged.ref << "]";
|
return stream << '[' << tagged.tag << ':' << tagged.ref << ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class ValueT>
|
template <class ValueT>
|
||||||
@ -327,7 +327,7 @@ using format::tag;
|
|||||||
|
|
||||||
template <class A, class B>
|
template <class A, class B>
|
||||||
StringBuilder &operator<<(StringBuilder &sb, const std::pair<A, B> &p) {
|
StringBuilder &operator<<(StringBuilder &sb, const std::pair<A, B> &p) {
|
||||||
return sb << "[" << p.first << ";" << p.second << "]";
|
return sb << '[' << p.first << ';' << p.second << ']';
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
|
Loading…
Reference in New Issue
Block a user