result_type visit()

in fatal/container/legacy_variant.h [1844:1857]


result_type visit(
  variant<TStoragePolicy, Args...> &&variant,
  visitor_type &&visitor,
  UArgs &&...args
) {
  auto wrapper = wrap_visitor<result_type>(visitor);
  variant.visit(wrapper, std::forward<UArgs>(args)...);

  if (!wrapper.has_value()) {
    throw std::logic_error("there's no value returned by the visitor");
  }

  return std::move(wrapper.value());
}