iterator/infix: determine container value_type via its iterators
This commit is contained in:
parent
8fdb09c95c
commit
8da3cc3293
@ -74,10 +74,15 @@ namespace cruft::iterator {
|
|||||||
std::ostream&
|
std::ostream&
|
||||||
operator<< (std::ostream &os, const infix_t<ContainerT,CharT> &val)
|
operator<< (std::ostream &os, const infix_t<ContainerT,CharT> &val)
|
||||||
{
|
{
|
||||||
|
using iterator_type = std::decay_t<
|
||||||
|
decltype(std::begin (std::declval<ContainerT> ()))
|
||||||
|
>;
|
||||||
|
using value_type = typename std::iterator_traits<iterator_type >::value_type;
|
||||||
|
|
||||||
std::copy (
|
std::copy (
|
||||||
std::cbegin (val._container),
|
std::cbegin (val._container),
|
||||||
std::cend (val._container),
|
std::cend (val._container),
|
||||||
infix_iterator<typename ContainerT::value_type> (os, val._delimiter)
|
infix_iterator<value_type> (os, val._delimiter)
|
||||||
);
|
);
|
||||||
|
|
||||||
return os;
|
return os;
|
||||||
|
Loading…
Reference in New Issue
Block a user