Commit f5aa6154 authored by Kenneth Hanley's avatar Kenneth Hanley
Browse files

Fix type and variable naming

parent 22fdc78a
......@@ -5,64 +5,65 @@ namespace visit_bools {
namespace detail {
template<size_t... N, typename Callback, typename ArgsTuple>
template<size_t... N, typename Callable, typename ArgsTuple>
constexpr decltype(auto) invoke_tuple(
std::index_sequence<N...>, Callback&& callback, ArgsTuple&& args
std::index_sequence<N...>, Callable&& callable, ArgsTuple&& args
) {
return callback(std::get<N>(std::forward<ArgsTuple>(args))...);
return callable(std::get<N>(std::forward<ArgsTuple>(args))...);
}
template<typename Callback, typename ArgsTuple>
constexpr decltype(auto) visit_bools_impl(Callback&& callback, ArgsTuple&& args) {
template<typename Callable, typename ArgsTuple>
constexpr decltype(auto) visit_bools_impl(Callable&& callable, ArgsTuple&& args) {
return invoke_tuple(
std::make_index_sequence<std::tuple_size<ArgsTuple>::value>(),
std::forward<Callback>(callback), std::forward<ArgsTuple>(args)
std::forward<Callable>(callable), std::forward<ArgsTuple>(args)
);
}
template<typename TupleHead, typename Callback, typename... Args>
template<typename ArgsLeftTuple, typename Callable, typename... ArgsRight>
constexpr decltype(auto) visit_bools_impl(
Callback&& callback, TupleHead&& head, bool arg, Args&&... args
Callable&& callable, ArgsLeftTuple&& args_left_tuple, bool arg,
ArgsRight&&... args_right
);
template<typename TupleHead, typename Callback, typename Arg, typename... Args>
template<typename ArgsLeftTuple, typename Callable, typename Arg, typename... ArgsRight>
constexpr decltype(auto) visit_bools_impl(
Callback&& callback, TupleHead&& head, Arg&& arg,
Args&&... args
Callable&& callable, ArgsLeftTuple&& args_left_tuple, Arg&& arg,
ArgsRight&&... args_right
) {
return visit_bools_impl(
std::forward<Callback>(callback),
std::forward<Callable>(callable),
std::tuple_cat(
std::forward<TupleHead>(head),
std::forward<ArgsLeftTuple>(args_left_tuple),
std::forward_as_tuple(std::forward<Arg>(arg))
),
std::forward<Args>(args)...
std::forward<ArgsRight>(args_right)...
);
}
template<typename TupleHead, typename Callback, typename... Args>
template<typename ArgsLeftTuple, typename Callable, typename... ArgsRight>
constexpr decltype(auto) visit_bools_impl(
Callback&& callback, TupleHead&& head, bool arg,
Args&&... args
Callable&& callable, ArgsLeftTuple&& args_left_tuple, bool arg,
ArgsRight&&... args_right
) {
if(arg) {
return visit_bools_impl(
std::forward<Callback>(callback),
std::forward<Callable>(callable),
std::tuple_cat(
std::forward<TupleHead>(head),
std::forward<ArgsLeftTuple>(args_left_tuple),
std::forward_as_tuple(std::true_type{})
),
std::forward<Args>(args)...
std::forward<ArgsRight>(args_right)...
);
}
else {
return visit_bools_impl(
std::forward<Callback>(callback),
std::forward<Callable>(callable),
std::tuple_cat(
std::forward<TupleHead>(head),
std::forward<ArgsLeftTuple>(args_left_tuple),
std::forward_as_tuple(std::false_type{})
),
std::forward<Args>(args)...
std::forward<ArgsRight>(args_right)...
);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment