Function template type_safe::visit [optional]

Effects: Effectively calls visitor((optionals.has_value() ? optionals.value() : nullopt)...), i.e. the operator() of visitor passing it sizeof...(Optionals) arguments, where the ith argument is the value() of the ith optional or nullopt, if it has none. If the particular combination of types is not overloaded, the program is ill-formed, unless the Visitor provides a member named incomplete_visitor, then visit() does not do anything instead of the error.

Returns: The result of the chosen operator(), its the type is the common type of all possible combinations.

Effects: Effectively calls visitor(variants.value(variant_type<Ts>{})...), where Ts... are the types of the currently active element in the variant, i.e. it calls the operator() of the visitor where the ith argument is the currently stored value in the ith variant, perfectly forwarded. If the ith variant is empty and it allows the empty state, it passes nullvar as parameter, otherwise the behavior is undefined. If the particular combination of types is not overloaded, the program is ill-formed, unless the Visitor provides a member named incomplete_visitor, then visit() does not do anything instead of the error. \returns The result of the chosen operator(), its the type is the common type of all possible combinations. \exclude return \module variant