Enable iteration over just types (not values) with Hybrid::forEach()
This makes it possible to iterate over a list of types without the need to create objects of those types. Example:
using namespace Hybrid;
forEach(TypeList<void, NonConstructible, int>{}, [] (auto metaType) {
std::cout << className<typename decltype(metaType)::type>() << std::endl;
});
This comes from our internal module dune-react, where I use this to iterate over a list of grid manager types.
This is a follow-up to !210 (closed). The difference is that this now uses the existing type TypeList
as the list of types. It still uses MetaType<T>
to wrap a single type T
, and TypeList<T...>
has been changed to an alias of std::tuple<MetaType<T>...>
.
Closes: !210 (closed).
Planned merge: 2017-05-12