coord: use new template form in ostream operators

This commit is contained in:
Danny Robson 2017-11-24 17:18:43 +11:00
parent a8088d03cd
commit a0b0863d61

View File

@ -17,6 +17,7 @@
#ifndef CRUFT_UTIL_IOSTREAM #ifndef CRUFT_UTIL_IOSTREAM
#define CRUFT_UTIL_IOSTREAM #define CRUFT_UTIL_IOSTREAM
#include "./traits.hpp"
#include "../iterator.hpp" #include "../iterator.hpp"
#include <cstddef> #include <cstddef>
@ -25,17 +26,16 @@
namespace util { namespace util {
template < template <
template <std::size_t,typename> class K, typename K,
std::size_t S, typename = std::enable_if_t<is_coord_v<K>,void>
typename T
> >
std::ostream& std::ostream&
operator<< (std::ostream &os, const K<S,T> &k) operator<< (std::ostream &os, const K &k)
{ {
os << "["; os << "[";
std::transform (std::cbegin (k), std::transform (std::cbegin (k),
std::cend (k), std::cend (k),
infix_iterator<T> (os, ", "), infix_iterator<typename K::value_type> (os, ", "),
[] (auto i) { return +i; }); [] (auto i) { return +i; });
os << "]"; os << "]";