Skip to content

Commit 57a4fe3

Browse files
committed
I prefer 8 bit integers printing as integers instead of chars
1 parent 19ac190 commit 57a4fe3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

include/Containers/TinyVector.hpp

+8-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <algorithm>
66
#include <cstddef>
77
#include <initializer_list>
8-
#include <iostream>
98
#include <limits>
109

1110
namespace poly::containers {
@@ -98,9 +97,15 @@ template <class T, size_t N, typename L = ptrdiff_t> class TinyVector {
9897
friend inline auto operator<<(std::ostream &os, const TinyVector &x)
9998
-> std::ostream & {
10099
os << "[";
101-
if (!x.empty()) os << x[0];
102-
for (L i = 1; i < x.size(); ++i) os << ", " << x[i];
100+
if constexpr (std::same_as<T, int8_t> || std::same_as<T, uint8_t>) {
101+
if (!x.empty()) os << x[0];
102+
for (L i = 1; i < x.size(); ++i) os << ", " << x[i];
103+
} else {
104+
if (!x.empty()) os << x[0];
105+
for (L i = 1; i < x.size(); ++i) os << ", " << x[i];
106+
}
103107
return os << "]";
104108
}
105109
};
106110
} // namespace poly::containers
111+

0 commit comments

Comments
 (0)