8000
Skip to content

Allowing formatting non-copyable ranges.#3290

Merged
vitaut merged 4 commits intofmtlib:masterfrom
brevzin:fmt-noncopyable-range
Jan 27, 2023
Merged

Allowing formatting non-copyable ranges.#3290
vitaut merged 4 commits intofmtlib:masterfrom
brevzin:fmt-noncopyable-range

Conversation

@brevzin
Copy link
Copy Markdown
Contributor
@brevzin brevzin commented Jan 26, 2023

Fixes #3286

@brevzin
Copy link
Copy Markdown
Contributor Author
brevzin commented Jan 26, 2023

Some windows build is complaining about noncopyable_range<int> & being non-formattable, but I'm not sure why. Do you know what version "(windows-2019, x64, v140, 14)" corresponds to on compiler-explorer? Could try to repro something there.

@mwinterb
Copy link
Copy Markdown
Contributor

It's not an exact match, but the general "era" matches "x64 msvc v19.0 (WINE)".

@brevzin
Copy link
Copy Markdown
Contributor Author
brevzin commented Jan 26, 2023

wat: https://godbolt.org/z/b9TYxqh6s

namespace my {
namespace detail {
    template <typename... > using void_t = void;
}
}

template <typename T>
struct has_mutable_begin_end<
    T, 
    #if 1
    fmt::detail::void_t<
    #else
    my::detail::void_t<
    #endif
        decltype(fmt::detail::range_begin(std::declval<T>()))
        , decltype(fmt::detail::range_end(std::declval<T>()))
        #if 0
        , int
        #endif
        >>
    : std::true_type {};

static_assert(has_mutable_begin_end<noncopyable_range>::value, "");

If I use my::detail::void_t, this works.

If I use fmt::detail::void_t, which is ... the same thing as my::detail::void_t, it fails. Unless I add the extra int at the end, in which case it works?

Copy link
Copy Markdown
Contributor
@vitaut vitaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR.

@vitaut vitaut merged commit 05e3a92 into fmtlib:master Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't format move-only ranges

3 participants

0