-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p0870r6.html
template<class From, class To>
concept is_convertible_without_narrowing = std::is_convertible_v<From, To> &&
requires (From&& x) {
{ std::type_identity_t<To[]>{std::forward<From>(x)} } -> std::same_as<To[1]>;
};I think our version (quoted below) can be rewritten with the standard utility above, but we must make sure that our test suite passes, and also that the IDE completion will not fail
iris/include/iris/type_traits.hpp
Lines 240 to 256 in ef4da2a
| // This version works better than MSVC's, does not break IntelliSense or ReSharper | |
| template<std::size_t I, class Ti> | |
| struct aggregate_initialize_overload | |
| { | |
| using TiA = Ti[]; | |
| // https://eel.is/c++draft/dcl.init.general#14 | |
| // https://eel.is/c++draft/dcl.init.list#3.4 | |
| // https://eel.is/c++draft/dcl.init.aggr#3 | |
| template<class T> | |
| auto operator()(Ti, T&&) -> aggregate_initialize_tag<I, Ti> | |
| requires requires(T&& t) { { TiA{std::forward<T>(t)} }; } // emulate `Ti x[] = {std::forward<T>(t)};` | |
| { | |
| return {}; // silence MSVC warning | |
| } | |
| }; |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request