2016-03-11 12:48:19 +11:00
|
|
|
/*
|
2018-08-04 15:14:06 +10:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2016-03-11 12:48:19 +11:00
|
|
|
*
|
2017-08-28 12:25:23 +10:00
|
|
|
* Copyright 2016-2017 Danny Robson <danny@nerdcruft.net>
|
2016-03-11 12:48:19 +11:00
|
|
|
*/
|
|
|
|
|
2017-08-28 12:25:23 +10:00
|
|
|
#ifndef CRUFT_UTIL_IOSTREAM
|
|
|
|
#define CRUFT_UTIL_IOSTREAM
|
2016-03-11 12:48:19 +11:00
|
|
|
|
2017-11-24 17:18:43 +11:00
|
|
|
#include "./traits.hpp"
|
2016-03-11 12:48:19 +11:00
|
|
|
#include "../iterator.hpp"
|
|
|
|
|
2017-08-28 12:25:23 +10:00
|
|
|
#include <cstddef>
|
2016-03-11 12:48:19 +11:00
|
|
|
#include <ostream>
|
2016-03-11 13:01:57 +11:00
|
|
|
#include <algorithm>
|
2016-03-11 12:48:19 +11:00
|
|
|
|
2018-08-05 14:42:02 +10:00
|
|
|
namespace cruft {
|
2016-03-11 12:48:19 +11:00
|
|
|
template <
|
2017-11-24 17:18:43 +11:00
|
|
|
typename K,
|
|
|
|
typename = std::enable_if_t<is_coord_v<K>,void>
|
2016-03-11 12:48:19 +11:00
|
|
|
>
|
|
|
|
std::ostream&
|
2017-11-24 17:18:43 +11:00
|
|
|
operator<< (std::ostream &os, const K &k)
|
2016-03-11 12:48:19 +11:00
|
|
|
{
|
|
|
|
os << "[";
|
|
|
|
std::transform (std::cbegin (k),
|
|
|
|
std::cend (k),
|
2017-11-24 17:18:43 +11:00
|
|
|
infix_iterator<typename K::value_type> (os, ", "),
|
2016-06-29 17:52:26 +10:00
|
|
|
[] (auto i) { return +i; });
|
2016-03-11 12:48:19 +11:00
|
|
|
os << "]";
|
|
|
|
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|