31template<
typename... Args>
32struct variant_visitor : Args... {
33 variant_visitor(Args&&... a) : Args(
std::move(a))... {}
34 using Args::operator()...;
37template<
typename... Args> variant_visitor(Args&&...) -> variant_visitor<Args...>;
51template <
typename... Args>
54 return internal::variant_visitor<Args...>(std::forward<Args>(args)...);
67template <
typename Variant,
typename... Args>
68inline auto visit(Variant&& variant, Args&&... args)
70 static_assert(
sizeof...(Args) > 0,
"At least one lambda must be provided for visitation");
77template<
typename... Args>
78struct castable_variant {
79 std::variant<Args...> var;
81 template<
typename... SuperArgs>
82 operator std::variant<SuperArgs...>() && {
84 return std::variant<SuperArgs...>(std::move(x));
90template<
typename... Args>
91internal::castable_variant<Args...> variant_cast(std::variant<Args...>&& var) {
92 return {std::move(var)};
95template<
typename... Args>
96internal::castable_variant<Args...> variant_cast(
const std::variant<Args...>& var) {
auto make_visitor(Args &&... args)
Definition: variant_utils.hh:52
auto visit(Variant &&variant, Args &&... args)
Definition: variant_utils.hh:68
Seastar API namespace.
Definition: abort_on_ebadf.hh:26