Skip to content

Commit

Permalink
Make iterator_t an alias template
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jun 14, 2019
1 parent 874d672 commit 12f4683
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions include/fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,8 @@ inline Dest bit_cast(const Source& source) {
}

// An implementation of iterator_t for pre-C++20 systems.
template <typename T> struct iterator_t {
typedef decltype(std::begin(std::declval<const T&>())) type;
};
template <typename T>
using iterator_t = decltype(std::begin(std::declval<T&>()));

template <typename Allocator>
typename Allocator::value_type* allocate(Allocator& alloc, std::size_t n) {
Expand Down Expand Up @@ -3313,13 +3312,13 @@ arg_join<It, wchar_t> join(It begin, It end, wstring_view sep) {
\endrst
*/
template <typename Range>
arg_join<typename internal::iterator_t<Range>::type, char> join(
arg_join<internal::iterator_t<const Range>, char> join(
const Range& range, string_view sep) {
return join(std::begin(range), std::end(range), sep);
}

template <typename Range>
arg_join<typename internal::iterator_t<Range>::type, wchar_t> join(
arg_join<internal::iterator_t<const Range>, wchar_t> join(
const Range& range, wstring_view sep) {
return join(std::begin(range), std::end(range), sep);
}
Expand Down

0 comments on commit 12f4683

Please sign in to comment.