Skip to content

Commit

Permalink
Make AsHex more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Jun 1, 2024
1 parent a912102 commit e94886f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/array19.lib/array19/DynamicArrayOf.AsHex.ostream.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@

namespace array19 {

template<class T> struct AsHex {
const DynamicArrayOf<T>& a;
template<class T> struct AsHex;

template<class T> struct AsHex<DynamicArrayOf<T>> {
using Array = DynamicArrayOf<T>;
const Array& a;

template<class Chr, class Traits>
friend auto operator<<(std::basic_ostream<Chr, Traits>& out, AsHex<T>&& a) -> decltype(out)& {
friend auto operator<<(std::basic_ostream<Chr, Traits>& out, AsHex<Array>&& a) -> decltype(out)& {
out << "[";
bool first = true;
for (auto& v : a.a) {
Expand All @@ -24,4 +27,6 @@ template<class T> struct AsHex {
}
};

template<class T> AsHex(DynamicArrayOf<T>&&) -> AsHex<DynamicArrayOf<T>>;

} // namespace array19

0 comments on commit e94886f

Please sign in to comment.