BloombergLP::bslstl::Variant_Function

Component-private vtable entry invoking a visitor on alternative t_INDEX.

Synopsis

Declared in <bslstl_variant.h>

template<
    class t_RET,
    class t_VISITOR,
    class t_VARIANT,
    size_t t_INDEX>
struct Variant_Function;

Static Member Functions

NameDescription
functionImpl This component-private function invokes the specified visitor with the active alternative object of the specified variant and implicitly converts the return type to (template parameter) t_RET. The pre-C++17 implementation is limited to invocations of the form visitor(variant). The behavior is undefined unless (template parameter) t_INDEX is the index of the active alternative.

Specializations

NameDescription
Variant_Function<void, t_VISITOR, t_VARIANT, t_INDEX> This partial specialization is used when t_RET is void. The visitor is invoked and its return value, if any, is ignored. This partial specialization is necessary because a void-returning function cannot contain a return statement with a non-void operand.