boost::openmethod::virtual_boost_any
Alias for a virtual_any<boost::any>, in the default registry.
Synopsis
Declared in <boost/openmethod/interop/boost_any.hpp>
using virtual_boost_any = virtual_any<boost::any>;
Description
With another registry, use virtual_any<boost::any, Registry> directly.
The root class of the contained types is boost::any, distinct from the std::any root, so both may be used in the same program, and with the same registry.
Example
struct Dog {
std::string name;
};
// `boost::any` is a root class of its own, distinct from the one used for
// `std::any`, so both may be used in the same program and registry.
BOOST_OPENMETHOD(name, (const virtual_boost_any&), std::string);
BOOST_OPENMETHOD_OVERRIDE(name, (const Dog& dog), std::string) {
return dog.name + " the dog";
}
BOOST_OPENMETHOD_OVERRIDE(name, (const std::string& name), std::string) {
return name;
}
virtual_boost_any felix = std::string("Felix the cat");
std::cout << name(felix) << "\n"; // Felix the cat
See Also
Created with MrDocs