Skip to content

Commit 1380b7e

Browse files
committed
Rename "aggregate_initialize" to "no_narrowing"
1 parent daab5d1 commit 1380b7e

2 files changed

Lines changed: 19 additions & 18 deletions

File tree

include/iris/rvariant/rvariant.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -620,10 +620,10 @@ class rvariant : private detail::rvariant_base_t<Ts...>
620620
(!std::is_same_v<std::remove_cvref_t<T>, rvariant>) &&
621621
(!is_ttp_specialization_of_v<std::remove_cvref_t<T>, std::in_place_type_t>) &&
622622
(!is_ctp_specialization_of_v<std::remove_cvref_t<T>, std::in_place_index_t>) &&
623-
std::is_constructible_v<typename aggregate_initialize_resolution<T, Ts...>::type, T>
623+
std::is_constructible_v<typename no_narrowing_resolution<T, Ts...>::type, T>
624624
constexpr /* not explicit */ rvariant(T&& t)
625-
noexcept(std::is_nothrow_constructible_v<typename aggregate_initialize_resolution<T, Ts...>::type, T>)
626-
: base_type(std::in_place_index<aggregate_initialize_resolution<T, Ts...>::index>, std::forward<T>(t))
625+
noexcept(std::is_nothrow_constructible_v<typename no_narrowing_resolution<T, Ts...>::type, T>)
626+
: base_type(std::in_place_index<no_narrowing_resolution<T, Ts...>::index>, std::forward<T>(t))
627627
{}
628628

629629
IRIS_RVARIANT_ALWAYS_THROWING_UNREACHABLE_BEGIN
@@ -632,12 +632,12 @@ IRIS_RVARIANT_ALWAYS_THROWING_UNREACHABLE_BEGIN
632632
template<class T>
633633
requires
634634
(!std::is_same_v<std::remove_cvref_t<T>, rvariant>) &&
635-
detail::variant_assignable<typename aggregate_initialize_resolution<T, Ts...>::type, T>::value
635+
detail::variant_assignable<typename no_narrowing_resolution<T, Ts...>::type, T>::value
636636
constexpr rvariant& operator=(T&& t)
637-
noexcept(detail::variant_nothrow_assignable<typename aggregate_initialize_resolution<T, Ts...>::type, T>::value)
637+
noexcept(detail::variant_nothrow_assignable<typename no_narrowing_resolution<T, Ts...>::type, T>::value)
638638
{
639-
using Tj = aggregate_initialize_resolution<T, Ts...>::type; // either plain type or wrapped with recursive_wrapper
640-
constexpr std::size_t j = aggregate_initialize_resolution<T, Ts...>::index;
639+
using Tj = no_narrowing_resolution<T, Ts...>::type; // either plain type or wrapped with recursive_wrapper
640+
constexpr std::size_t j = no_narrowing_resolution<T, Ts...>::index;
641641
static_assert(j != std::variant_npos);
642642

643643
this->raw_visit([this, &t]<std::size_t i, class Ti>(std::in_place_index_t<i>, [[maybe_unused]] Ti& ti)

include/iris/type_traits.hpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -272,37 +272,38 @@ struct aggregate_initialize_tag
272272
};
273273

274274
template<std::size_t I, class Ti>
275-
struct aggregate_initialize_overload
275+
struct no_narrowing_overload
276276
{
277277
template<class T>
278-
auto operator()(Ti, T&&) -> aggregate_initialize_tag<I, Ti>
278+
auto operator()(T&&) -> aggregate_initialize_tag<I, Ti>
279279
requires is_convertible_without_narrowing_v<T, Ti>
280280
{
281281
return {}; // silence MSVC warning
282282
}
283283
};
284284

285285
template<class Is, class... Ts>
286-
struct aggregate_initialize_fun;
286+
struct no_narrowing_fun;
287287

288288
// Imaginary function FUN of https://eel.is/c++draft/variant#ctor-14
289289
template<std::size_t... Is, class... Ts>
290-
struct aggregate_initialize_fun<std::index_sequence<Is...>, Ts...>
291-
: aggregate_initialize_overload<Is, Ts>...
290+
struct no_narrowing_fun<std::index_sequence<Is...>, Ts...>
291+
: no_narrowing_overload<Is, Ts>...
292292
{
293-
using aggregate_initialize_overload<Is, Ts>::operator()...;
293+
using no_narrowing_overload<Is, Ts>::operator()...;
294294
};
295295

296296
template<class... Ts>
297-
using aggregate_initialize_fun_for = aggregate_initialize_fun<std::index_sequence_for<Ts...>, Ts...>;
297+
using aggregate_initialize_fun_for = no_narrowing_fun<std::index_sequence_for<Ts...>, Ts...>;
298298

299299
template<class Enabled, class T, class... Ts>
300-
struct aggregate_initialize_resolution {};
300+
struct no_narrowing_resolution {};
301301

302302
template<class T, class... Ts>
303-
struct aggregate_initialize_resolution<
303+
struct no_narrowing_resolution<
304304
std::void_t<decltype(aggregate_initialize_fun_for<Ts...>{}(std::declval<T>(), std::declval<T>()))>, T, Ts...
305-
> {
305+
>
306+
{
306307
using tag = decltype(aggregate_initialize_fun_for<Ts...>{}(std::declval<T>(), std::declval<T>()));
307308
using type = tag::type;
308309
static constexpr std::size_t index = tag::index;
@@ -314,7 +315,7 @@ struct aggregate_initialize_resolution<
314315
// because they would lead to unnecessarily nested instantiation for
315316
// legitimate infinite recursion errors on recursive types.
316317
template<class T, class... Ts>
317-
struct aggregate_initialize_resolution : detail::aggregate_initialize_resolution<void, T, Ts...> {};
318+
struct no_narrowing_resolution : detail::no_narrowing_resolution<void, T, Ts...> {};
318319

319320
} // iris
320321

0 commit comments

Comments
 (0)