From f7abb3201eb265e4fa2b42bc972a750534b03a4b Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Wed, 30 Sep 2020 10:57:15 +1000 Subject: [PATCH] iterator/infix: add complete make_infix overload for arrays --- iterator/infix.hpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/iterator/infix.hpp b/iterator/infix.hpp index 2c6c27db..5d943e21 100644 --- a/iterator/infix.hpp +++ b/iterator/infix.hpp @@ -75,7 +75,7 @@ namespace cruft::iterator { operator<< (std::ostream &os, const infix_t &val) { using iterator_type = std::decay_t< - decltype(std::begin (std::declval ())) + decltype(std::begin (val._container)) >; using value_type = typename std::iterator_traits::value_type; @@ -87,8 +87,7 @@ namespace cruft::iterator { return os; } - - }; + } /// 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'; template auto - make_infix (const ContainerT &_container, const CharT *_delimiter = ", ") + make_infix (ContainerT const &_container, const CharT *_delimiter = ", ") { return detail::infix_t { _container, _delimiter }; } - template + template 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 + auto + make_infix (ValueT (&val)[CountV], CharT const *delimiter = ", ") + { + return make_infix (cruft::view {val}, delimiter); + } }