iterator/infix: add complete make_infix overload for arrays
This commit is contained in:
parent
19551e30ed
commit
f7abb3201e
@ -75,7 +75,7 @@ namespace cruft::iterator {
|
|||||||
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<
|
using iterator_type = std::decay_t<
|
||||||
decltype(std::begin (std::declval<ContainerT> ()))
|
decltype(std::begin (val._container))
|
||||||
>;
|
>;
|
||||||
using value_type = typename std::iterator_traits<iterator_type >::value_type;
|
using value_type = typename std::iterator_traits<iterator_type >::value_type;
|
||||||
|
|
||||||
@ -87,8 +87,7 @@ namespace cruft::iterator {
|
|||||||
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/// a helper function that returns an object that will use a
|
/// a helper function that returns an object that will use a
|
||||||
@ -100,18 +99,24 @@ namespace cruft::iterator {
|
|||||||
/// std::cout << cruft::make_infix (container) << '\n';
|
/// std::cout << cruft::make_infix (container) << '\n';
|
||||||
template <typename ContainerT, typename CharT = char>
|
template <typename ContainerT, typename CharT = char>
|
||||||
auto
|
auto
|
||||||
make_infix (const ContainerT &_container, const CharT *_delimiter = ", ")
|
make_infix (ContainerT const &_container, const CharT *_delimiter = ", ")
|
||||||
{
|
{
|
||||||
return detail::infix_t<ContainerT,CharT> { _container, _delimiter };
|
return detail::infix_t<ContainerT,CharT> { _container, _delimiter };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename ValueT, size_t CountV>
|
template <typename ValueT, size_t CountV, typename CharT>
|
||||||
auto
|
auto
|
||||||
make_infix (const ValueT (&val)[CountV])
|
make_infix (const ValueT (&val)[CountV], CharT const *delimiter = ", ")
|
||||||
{
|
{
|
||||||
return make_infix (cruft::view {val});
|
return make_infix (cruft::view {val}, delimiter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename ValueT, size_t CountV, typename CharT>
|
||||||
|
auto
|
||||||
|
make_infix (ValueT (&val)[CountV], CharT const *delimiter = ", ")
|
||||||
|
{
|
||||||
|
return make_infix (cruft::view {val}, delimiter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user