-
Notifications
You must be signed in to change notification settings - Fork 0
Add is_convertible_without_narrowing
#54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
384edff
37bf953
6443dfa
65e4638
9ba01d3
0b16dda
1a0b140
1a35a62
8a4f052
b9c6216
cdec1b1
daab5d1
1380b7e
66ca64b
de99433
c378972
80ad201
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
This reverts commit 1380b7e.
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -272,38 +272,37 @@ struct aggregate_initialize_tag | |
| }; | ||
|
|
||
| template<std::size_t I, class Ti> | ||
| struct no_narrowing_overload | ||
| struct aggregate_initialize_overload | ||
| { | ||
| template<class T> | ||
| auto operator()(T&&) -> aggregate_initialize_tag<I, Ti> | ||
| auto operator()(Ti, T&&) -> aggregate_initialize_tag<I, Ti> | ||
| requires is_convertible_without_narrowing_v<T, Ti> | ||
|
Comment on lines
277
to
+279
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the first parameter
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, the For example, constructing |
||
| { | ||
| return {}; // silence MSVC warning | ||
| } | ||
| }; | ||
|
|
||
| template<class Is, class... Ts> | ||
| struct no_narrowing_fun; | ||
| struct aggregate_initialize_fun; | ||
|
|
||
| // Imaginary function FUN of https://eel.is/c++draft/variant#ctor-14 | ||
| template<std::size_t... Is, class... Ts> | ||
| struct no_narrowing_fun<std::index_sequence<Is...>, Ts...> | ||
| : no_narrowing_overload<Is, Ts>... | ||
| struct aggregate_initialize_fun<std::index_sequence<Is...>, Ts...> | ||
| : aggregate_initialize_overload<Is, Ts>... | ||
| { | ||
| using no_narrowing_overload<Is, Ts>::operator()...; | ||
| using aggregate_initialize_overload<Is, Ts>::operator()...; | ||
| }; | ||
|
|
||
| template<class... Ts> | ||
| using aggregate_initialize_fun_for = no_narrowing_fun<std::index_sequence_for<Ts...>, Ts...>; | ||
| using aggregate_initialize_fun_for = aggregate_initialize_fun<std::index_sequence_for<Ts...>, Ts...>; | ||
|
|
||
| template<class Enabled, class T, class... Ts> | ||
| struct no_narrowing_resolution {}; | ||
| struct aggregate_initialize_resolution {}; | ||
|
|
||
| template<class T, class... Ts> | ||
| struct no_narrowing_resolution< | ||
| struct aggregate_initialize_resolution< | ||
| std::void_t<decltype(aggregate_initialize_fun_for<Ts...>{}(std::declval<T>(), std::declval<T>()))>, T, Ts... | ||
| > | ||
| { | ||
| > { | ||
| using tag = decltype(aggregate_initialize_fun_for<Ts...>{}(std::declval<T>(), std::declval<T>())); | ||
| using type = tag::type; | ||
| static constexpr std::size_t index = tag::index; | ||
|
|
@@ -315,7 +314,7 @@ struct no_narrowing_resolution< | |
| // because they would lead to unnecessarily nested instantiation for | ||
| // legitimate infinite recursion errors on recursive types. | ||
| template<class T, class... Ts> | ||
| struct no_narrowing_resolution : detail::no_narrowing_resolution<void, T, Ts...> {}; | ||
| struct aggregate_initialize_resolution : detail::aggregate_initialize_resolution<void, T, Ts...> {}; | ||
|
|
||
| } // iris | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.