Skip to content

Commit

Permalink
Fix missing std::get overload in MSVC
Browse files Browse the repository at this point in the history
This replaces the `std::get` call with an unqualified equivalent to allow
it to be treated as a dependent call.

ranges.h needs std::get overloads from `<tuple>` but does not directly
include it. This causes compilation failures in MSVC with /permissive-.
On other platforms `<tuple>` is included as a dependency from other headers
(specifically from `<memory>`), but there is no such implicit dependency in
MSVC's STL.

Fixes #2401
  • Loading branch information
joemmett committed Jul 1, 2021
1 parent 5f84739 commit 11112ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/fmt/ranges.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,8 @@ struct formatter<tuple_join_view<Char, T...>, Char> {
auto format(const tuple_join_view<Char, T...>& value, FormatContext& ctx,
detail::index_sequence<N...>) ->
typename FormatContext::iterator {
return format_args(value, ctx, std::get<N>(value.tuple)...);
using std::get;
return format_args(value, ctx, get<N>(value.tuple)...);
}

template <typename FormatContext>
Expand Down

0 comments on commit 11112ee

Please sign in to comment.