Skip to content

Commit f7aca9a

Browse files
committed
Make AsHex more generic
1 parent 3013bde commit f7aca9a

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/array19.lib/array19/DynamicArrayOf.AsHex.ostream.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@
66

77
namespace array19 {
88

9-
template<class T> struct AsHex {
10-
const DynamicArrayOf<T>& a;
9+
template<class T> struct AsHex;
10+
11+
template<class T> struct AsHex<DynamicArrayOf<T>> {
12+
using Array = DynamicArrayOf<T>;
13+
const Array& a;
1114

1215
template<class Chr, class Traits>
13-
friend auto operator<<(std::basic_ostream<Chr, Traits>& out, AsHex<T>&& a) -> decltype(out)& {
16+
friend auto operator<<(std::basic_ostream<Chr, Traits>& out, AsHex<Array>&& a) -> decltype(out)& {
1417
out << "[";
1518
bool first = true;
1619
for (auto& v : a.a) {
@@ -24,4 +27,6 @@ template<class T> struct AsHex {
2427
}
2528
};
2629

30+
template<class T> AsHex(DynamicArrayOf<T>&&) -> AsHex<DynamicArrayOf<T>>;
31+
2732
} // namespace array19

0 commit comments

Comments
 (0)