Registry / utility / boost-openmethod

boost-openmethod

JSON →
library1.90.0vcpkgunverified

Boost openmethod module providing open methods (multi-methods) for C++.

vcpkg install boost-openmethod
INSTALL
IMPORT
SIG · BOOST-OPENMETHOD
B
boost-openmethod
utilitycppv1.90.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

boost/openmethod.hpp
#include <boost/openmethod.hpp>

Define and use open methods with virtual dispatch.

#include <boost/openmethod.hpp> #include <iostream> struct Animal { virtual ~Animal() = default; }; struct Dog : Animal {}; struct Cat : Animal {}; BOOST_OPENMETHOD(void, speak, (const Animal&), boost::openmethod::virtual_); BOOST_OPENMETHOD_OVERRIDE(void, speak, (const Dog& d), boost::openmethod::virtual_) { std::cout << "Woof!\n"; } BOOST_OPENMETHOD_OVERRIDE(void, speak, (const Cat& c), boost::openmethod::virtual_) { std::cout << "Meow!\n"; } int main() { Dog d; Cat c; speak(d); speak(c); return 0; }
Debug
Known issues
gotchaRequires C++17 or later and Boost.Preprocessor.
fix
Ensure your compiler supports C++17 and link Boost.Preprocessor.
affects: *
Upgrade
Version history
1.90.0latest on vcpkg
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Meta
1
Resources

No resource links recorded.

boost-openmethod — pip install boost-openmethod · libregistry