Make join() handle non-const-only begin/end ranges (#1786)

See fmtlib/fmt#1784.

Add tests that demonstrate the problem and check obvious variations.
This commit is contained in:
Tony E Lewis
2020-07-21 20:13:00 +01:00
committed by GitHub
parent d69e2da221
commit febffa4e64
2 changed files with 38 additions and 5 deletions

View File

@@ -3420,15 +3420,14 @@ arg_join<It, Sentinel, wchar_t> join(It begin, Sentinel end, wstring_view sep) {
\endrst
*/
template <typename Range>
arg_join<detail::iterator_t<const Range>, detail::sentinel_t<const Range>, char>
join(const Range& range, string_view sep) {
arg_join<detail::iterator_t<Range>, detail::sentinel_t<Range>, char> join(
Range&& range, string_view sep) {
return join(std::begin(range), std::end(range), sep);
}
template <typename Range>
arg_join<detail::iterator_t<const Range>, detail::sentinel_t<const Range>,
wchar_t>
join(const Range& range, wstring_view sep) {
arg_join<detail::iterator_t<Range>, detail::sentinel_t<Range>, wchar_t> join(
Range&& range, wstring_view sep) {
return join(std::begin(range), std::end(range), sep);
}