|
BDE 4.39.x Production Release
|
Provide a type for constructing overload sets.
Provide a type for constructing overload sets.
This component provides a template class, bdlf::Overloaded, that allows you to construct callable objects that contain several function call overloads.
This is especially useful when dealing with variant objects, as they can be passed to std::visit or to bsl::visit, and depending on the type stored in the variant, the correct element of the overload set will be called.
This component requires C++17.
This section illustrates intended use of this component.
First, create a bsl::variant object that can contain several different types.
Next, Create an Overload object containing several options:
Set the value of variant, and then call std::visit, passing the overload set and the variant. Check the return value to see that the right lambda was called.