[#BloombergLP-bslstl-Variant_Function-0b] = xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bslstl.adoc[bslstl]::Variant_Function :relfileprefix: ../../ :mrdocs: Component‐private vtable entry invoking a visitor on alternative `t_INDEX`. == Synopsis Declared in `<bslstl_variant.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template< class t_RET, class t_VISITOR, class t_VARIANT, size_t t_INDEX> struct Variant_Function; ---- == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/Variant_Function-0b/functionImpl.adoc[`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 [cols="1,4"] |=== | Name| Description | xref:BloombergLP/bslstl/Variant_Function-05.adoc[`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. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#