#ifndef V8_BASE_TEMPLATE_UTILS_H_
#define V8_BASE_TEMPLATE_UTILS_H_
#include <array>
#include <functional>
#include <iosfwd>
#include <tuple>
#include <type_traits>
#include <utility>
namespace v8 {
namespace base {
namespace detail {
template <typename Function, std::size_t... Indexes>
constexpr inline auto make_array_helper(Function f,
std::index_sequence<Indexes...>)
-> std::array<decltype(f(0)), sizeof...(Indexes)> { … }
}
template <std::size_t Size, class Function>
constexpr auto make_array(Function f) { … }
template <typename T, bool remove_array_extend = true>
struct pass_value_or_ref { … };
template <typename T, typename TStream = std::ostream, typename = void>
struct has_output_operator : std::false_type { … };
has_output_operator<T, TStream, decltype(void(std::declval<TStream &>() << std::declval<T>()))>;
append_tuple_type;
prepend_tuple_type;
namespace detail {
NIsNotGreaterThanTupleSize;
template <size_t N, typename T, size_t... Ints>
constexpr auto tuple_slice_impl(const T& tpl, std::index_sequence<Ints...>) { … }
template <typename Tuple, typename Function, size_t... Index>
constexpr auto tuple_for_each_impl(const Tuple& tpl, Function&& function,
std::index_sequence<Index...>) { … }
template <typename Tuple, typename Function, size_t... Index>
constexpr auto tuple_for_each_with_index_impl(const Tuple& tpl,
Function&& function,
std::index_sequence<Index...>) { … }
template <typename Tuple, typename Function, size_t... Index>
constexpr auto tuple_map_impl(Tuple&& tpl, const Function& function,
std::index_sequence<Index...>) { … }
template <typename TupleV, typename TupleU, typename Function, size_t... Index>
constexpr auto tuple_map2_impl(TupleV&& tplv, TupleU&& tplu,
const Function& function,
std::index_sequence<Index...>) { … }
template <size_t I, typename T, typename Tuple, typename Function>
constexpr auto tuple_fold_impl(T&& initial, Tuple&& tpl, Function&& function) { … }
}
template <size_t N, typename Tuple>
constexpr auto tuple_head(Tuple&& tpl) { … }
template <
size_t N, typename Tuple,
typename = std::enable_if_t<detail::NIsNotGreaterThanTupleSize<N, Tuple>>>
constexpr auto tuple_drop(Tuple&& tpl) { … }
template <typename Tuple, typename Function>
constexpr void tuple_for_each(Tuple&& tpl, Function&& function) { … }
template <typename Tuple, typename Function>
constexpr void tuple_for_each_with_index(Tuple&& tpl, Function&& function) { … }
template <typename Tuple, typename Function>
constexpr auto tuple_map(Tuple&& tpl, Function&& function) { … }
template <typename TupleV, typename TupleU, typename Function>
constexpr auto tuple_map2(TupleV&& tplv, TupleU&& tplu, Function&& function) { … }
template <typename T, typename Tuple, typename Function>
constexpr auto tuple_fold(T&& initial, Tuple&& tpl, Function&& function) { … }
#ifdef __clang__
nth_type_t;
#else
namespace detail {
template <size_t N, typename... Ts>
struct nth_type;
template <typename T, typename... Ts>
struct nth_type<0, T, Ts...> {
using type = T;
};
template <size_t N, typename T, typename... Ts>
struct nth_type<N, T, Ts...> : public nth_type<N - 1, Ts...> {};
}
template <size_t N, typename... T>
using nth_type_t = typename detail::nth_type<N, T...>::type;
#endif
template <typename SearchT, typename... Ts>
struct index_of_type;
index_of_type_v;
has_type_v;
index_of_type<SearchT>;
index_of_type<SearchT, SearchT, Ts...>;
index_of_type<SearchT, T, Ts...>;
}
}
#endif