mirror of
https://github.com/boostorg/pfr.git
synced 2026-01-19 04:22:13 +00:00
cc: remove unused specializations, add details namespace to uses of make_integer_sequence
This commit is contained in:
@@ -366,7 +366,7 @@ template <class T>
|
||||
constexpr size_array<sizeof(T) * 3> fields_count_and_type_ids_with_zeros() noexcept {
|
||||
size_array<sizeof(T) * 3> types{};
|
||||
constexpr std::size_t N = detail::fields_count<T>();
|
||||
detail::flat_type_to_array_of_type_ids<T, N>(types.data, make_index_sequence<N>());
|
||||
detail::flat_type_to_array_of_type_ids<T, N>(types.data, detail::make_index_sequence<N>());
|
||||
return types;
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ constexpr auto prepare_subtuples(size_t_<typeid_conversions::tuple_end_tag>, siz
|
||||
template <class T, std::size_t I, std::size_t SubtupleLength>
|
||||
constexpr auto prepare_subtuples(size_t_<typeid_conversions::tuple_begin_tag>, size_t_<I>, size_t_<SubtupleLength>) noexcept {
|
||||
static_assert(SubtupleLength > 2, "====================> Boost.PFR: Internal error while representing nested field as tuple");
|
||||
constexpr auto seq = make_index_sequence<SubtupleLength - 2>{};
|
||||
constexpr auto seq = detail::make_index_sequence<SubtupleLength - 2>{};
|
||||
return detail::as_flat_tuple_impl<T>( detail::increment_index_sequence<I + 1>(seq) );
|
||||
}
|
||||
|
||||
@@ -496,7 +496,7 @@ constexpr auto as_flat_tuple_impl(std::index_sequence<First, I...>) noexcept {
|
||||
|
||||
return detail::as_flat_tuple_impl_drop_helpers<T>(
|
||||
std::index_sequence<First, I...>{},
|
||||
make_index_sequence< 1 + count_of_I - count_skips_in_array(First, First + count_of_I, a) >{}
|
||||
detail::make_index_sequence< 1 + count_of_I - count_skips_in_array(First, First + count_of_I, a) >{}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ constexpr auto internal_tuple_with_same_alignment() noexcept {
|
||||
static_assert(std::is_pod<type>::value, "====================> Boost.PFR: Type can not be used is flat_ functions, because it's not POD");
|
||||
static_assert(!std::is_reference<type>::value, "====================> Boost.PFR: Not applyable");
|
||||
constexpr auto res = detail::as_flat_tuple_impl<type>(
|
||||
make_index_sequence< decltype(detail::flat_array_of_type_ids<type>())::size() >()
|
||||
detail::make_index_sequence< decltype(detail::flat_array_of_type_ids<type>())::size() >()
|
||||
);
|
||||
|
||||
return res;
|
||||
@@ -566,7 +566,7 @@ auto tie_as_tuple(T& val) noexcept {
|
||||
"====================> Boost.PFR: For safety reasons it is forbidden to reflect unions. See `Reflection of unions` section in the docs for more info."
|
||||
);
|
||||
static_assert(
|
||||
boost::pfr::detail::is_flat_refelectable<T>( make_index_sequence<boost::pfr::detail::fields_count<T>()>{} ),
|
||||
boost::pfr::detail::is_flat_refelectable<T>( detail::make_index_sequence<boost::pfr::detail::fields_count<T>()>{} ),
|
||||
"====================> Boost.PFR: Not possible in C++14 to represent that type without loosing information. Use boost::pfr::flat_ version, or change type definition, or enable C++17"
|
||||
);
|
||||
return boost::pfr::detail::tie_as_flat_tuple(val);
|
||||
|
||||
@@ -104,7 +104,7 @@ struct loophole_type_list< T, std::index_sequence<I...> >
|
||||
template <class T>
|
||||
auto tie_as_tuple_loophole_impl(T& lvalue) noexcept {
|
||||
using type = std::remove_cv_t<std::remove_reference_t<T>>;
|
||||
using indexes = make_index_sequence<fields_count<type>()>;
|
||||
using indexes = detail::make_index_sequence<fields_count<type>()>;
|
||||
using tuple_type = typename loophole_type_list<type, indexes>::type;
|
||||
|
||||
return boost::pfr::detail::make_flat_tuple_of_references(
|
||||
@@ -169,7 +169,7 @@ auto tie_as_tuple_recursively_impl(T& tup, std::index_sequence<I...> ) noexcept
|
||||
|
||||
template <class T>
|
||||
auto tie_as_tuple_recursively(rvalue_t<T> tup) noexcept {
|
||||
using indexes = make_index_sequence<T::size_v>;
|
||||
using indexes = detail::make_index_sequence<T::size_v>;
|
||||
return boost::pfr::detail::tie_as_tuple_recursively_impl(tup, indexes{});
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ struct is_aggregate_initializable_n {
|
||||
std::is_empty<T>::value
|
||||
|| std::is_array<T>::value
|
||||
|| std::is_fundamental<T>::value
|
||||
|| is_not_constructible_n(make_index_sequence<N>{})
|
||||
|| is_not_constructible_n(detail::make_index_sequence<N>{})
|
||||
;
|
||||
};
|
||||
|
||||
@@ -88,7 +88,7 @@ template <class T, std::size_t... I, class /*Enable*/ = typename std::enable_if<
|
||||
constexpr auto enable_if_constructible_helper(std::index_sequence<I...>) noexcept
|
||||
-> typename std::add_pointer<decltype(T{ ubiq_rref_constructor{I}... })>::type;
|
||||
|
||||
template <class T, std::size_t N, class /*Enable*/ = decltype( enable_if_constructible_helper<T>(make_index_sequence<N>()) ) >
|
||||
template <class T, std::size_t N, class /*Enable*/ = decltype( enable_if_constructible_helper<T>(detail::make_index_sequence<N>()) ) >
|
||||
using enable_if_constructible_helper_t = std::size_t;
|
||||
|
||||
///////////////////// Non greedy fields count search. Templates instantiation depth is log(sizeof(T)), templates instantiation count is log(sizeof(T)).
|
||||
|
||||
@@ -29,7 +29,7 @@ struct flat_tie_from_structure_tuple : std::tuple<Elements&...> {
|
||||
base::operator=(
|
||||
detail::make_stdtiedtuple_from_tietuple(
|
||||
detail::tie_as_flat_tuple(t),
|
||||
make_index_sequence<flat_tuple_size_v<T>>()));
|
||||
detail::make_index_sequence<flat_tuple_size_v<T>>()));
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -64,8 +64,8 @@ constexpr auto my_tuple_cat_impl(const Tuple1& t1, std::index_sequence<I1...>, c
|
||||
template <class Tuple1, class Tuple2>
|
||||
constexpr auto my_tuple_cat(const Tuple1& t1, const Tuple2& t2) noexcept {
|
||||
return detail::my_tuple_cat_impl(
|
||||
t1, make_index_sequence< Tuple1::size_v >{},
|
||||
t2, make_index_sequence< Tuple2::size_v >{}
|
||||
t1, detail::make_index_sequence< Tuple1::size_v >{},
|
||||
t2, detail::make_index_sequence< Tuple2::size_v >{}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,9 @@ namespace boost { namespace pfr { namespace detail {
|
||||
|
||||
#if BOOST_PFR_USE_STD_INTEGRAL_SEQUENCE == 0
|
||||
|
||||
template <typename... T>
|
||||
template <typename T, typename U>
|
||||
struct join_sequences;
|
||||
|
||||
template <typename T, typename U, typename... V>
|
||||
struct join_sequences<T, U, V...>
|
||||
: join_sequences< typename join_sequences<T, U>::type, V...> {};
|
||||
|
||||
template <typename T, T... A, T... B>
|
||||
struct join_sequences<std::integer_sequence<T, A...>, std::integer_sequence<T, B...>> {
|
||||
using type = std::integer_sequence<T, A..., B...>;
|
||||
@@ -40,7 +36,6 @@ struct build_sequence_impl {
|
||||
|
||||
template <typename T, T V>
|
||||
struct build_sequence_impl<T, V, V> {
|
||||
static constexpr T size = 1;
|
||||
using type = std::integer_sequence<T, V>;
|
||||
};
|
||||
|
||||
|
||||
@@ -76,11 +76,11 @@ constexpr T&& get_impl(base_from_member<N, T>&& t) noexcept {
|
||||
|
||||
template <class ...Values>
|
||||
struct tuple: tuple_base<
|
||||
index_sequence_for<Values...>,
|
||||
detail::index_sequence_for<Values...>,
|
||||
Values...>
|
||||
{
|
||||
using tuple_base<
|
||||
index_sequence_for<Values...>,
|
||||
detail::index_sequence_for<Values...>,
|
||||
Values...
|
||||
>::tuple_base;
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ struct tie_from_structure_tuple : std::tuple<Elements&...> {
|
||||
base::operator=(
|
||||
detail::make_stdtiedtuple_from_tietuple(
|
||||
detail::tie_as_tuple(t),
|
||||
make_index_sequence<tuple_size_v<T>>()));
|
||||
detail::make_index_sequence<tuple_size_v<T>>()));
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -412,7 +412,7 @@ void test_and_debug_internals(std::index_sequence<I...>) {
|
||||
static_assert(
|
||||
std::is_same<
|
||||
decltype(boost::pfr::detail::as_flat_tuple_impl<type>(
|
||||
std::make_index_sequence< decltype(boost::pfr::detail::flat_array_of_type_ids<type>())::size() >()
|
||||
detail::make_index_sequence< decltype(boost::pfr::detail::flat_array_of_type_ids<type>())::size() >()
|
||||
)),
|
||||
boost::pfr::detail::sequence_tuple::tuple<boost::pfr::detail::sequence_tuple::tuple<short, char>, char, char>
|
||||
>::value,
|
||||
@@ -420,7 +420,7 @@ void test_and_debug_internals(std::index_sequence<I...>) {
|
||||
);
|
||||
|
||||
constexpr auto res = as_flat_tuple_impl<foo>(
|
||||
std::make_index_sequence< decltype(flat_array_of_type_ids<foo>())::size() >()
|
||||
detail::make_index_sequence< decltype(flat_array_of_type_ids<foo>())::size() >()
|
||||
);
|
||||
auto afoo = flat_array_of_type_ids<foo>();
|
||||
std::cerr << "\n\n";
|
||||
@@ -690,7 +690,7 @@ int main() {
|
||||
static_assert(tuple_size<decltype(i_2dimens)>::value == 4, "");
|
||||
static_assert(flat_tuple_size<decltype(i_2dimens)>::value == 4, "");
|
||||
|
||||
test_and_debug_internals(std::make_index_sequence<6>{});
|
||||
test_and_debug_internals(detail::make_index_sequence<6>{});
|
||||
test_alignment_with_nested_structure();
|
||||
another_test_with_unusual_alignment();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user