Make iterator_t an alias template

This commit is contained in:
Victor Zverovich 2019-06-13 21:32:58 -07:00
parent 874d6727e4
commit 12f4683883

View File

@ -266,9 +266,8 @@ inline Dest bit_cast(const Source& source) {
} }
// An implementation of iterator_t for pre-C++20 systems. // An implementation of iterator_t for pre-C++20 systems.
template <typename T> struct iterator_t { template <typename T>
typedef decltype(std::begin(std::declval<const T&>())) type; using iterator_t = decltype(std::begin(std::declval<T&>()));
};
template <typename Allocator> template <typename Allocator>
typename Allocator::value_type* allocate(Allocator& alloc, std::size_t n) { typename Allocator::value_type* allocate(Allocator& alloc, std::size_t n) {
@ -3313,13 +3312,13 @@ arg_join<It, wchar_t> join(It begin, It end, wstring_view sep) {
\endrst \endrst
*/ */
template <typename Range> 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) { const Range& range, string_view sep) {
return join(std::begin(range), std::end(range), sep); return join(std::begin(range), std::end(range), sep);
} }
template <typename Range> 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) { const Range& range, wstring_view sep) {
return join(std::begin(range), std::end(range), sep); return join(std::begin(range), std::end(range), sep);
} }