diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 0b6ec900..3ea41c8c 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -155,7 +155,9 @@ template struct has_mutable_begin_end< T, void_t())), decltype(detail::range_end(std::declval())), - enable_if_t::value>>> + // the extra int here is because older versions of MSVC don't + // SFINAE properly unless there are distinct types + int>> : std::true_type {}; template diff --git a/test/ranges-test.cc b/test/ranges-test.cc index fa46fc41..8cafeec4 100644 --- a/test/ranges-test.cc +++ b/test/ranges-test.cc @@ -193,7 +193,7 @@ template class noncopyable_range { std::vector vec; public: - using const_iterator = typename ::std::vector::const_iterator; + using iterator = typename ::std::vector::iterator; template explicit noncopyable_range(Args&&... args) @@ -202,8 +202,8 @@ template class noncopyable_range { noncopyable_range(noncopyable_range const&) = delete; noncopyable_range(noncopyable_range&) = delete; - const_iterator begin() const { return vec.begin(); } - const_iterator end() const { return vec.end(); } + iterator begin() { return vec.begin(); } + iterator end() { return vec.end(); } }; TEST(ranges_test, range) {