boost-type-erasure

C++ generic factory with multiple constructor signatures?

折月煮酒 提交于 2019-12-21 19:24:57
问题 Has anyone ever combined the classic generic factory by Andrei Alexandrescu (page 208 of Chapter 8 in Modern C++ Design) with the 'multifunction' capabilities of Boost.TypeErasure? That is, the flexibility to have several creator function signatures that vary with respect to number and type of parameters (but still have the same return type and are known at compile time). In other words, how to combine this slightly simplified generic Factory: #include <map> #include <utility> #include

C++ generic factory with multiple constructor signatures?

放肆的年华 提交于 2019-12-04 10:20:00
Has anyone ever combined the classic generic factory by Andrei Alexandrescu (page 208 of Chapter 8 in Modern C++ Design ) with the 'multifunction' capabilities of Boost.TypeErasure ? That is, the flexibility to have several creator function signatures that vary with respect to number and type of parameters (but still have the same return type and are known at compile time). In other words, how to combine this slightly simplified generic Factory: #include <map> #include <utility> #include <stdexcept> template <class AbstractProduct, typename IdentifierType, typename ProductCreator> class