I have a set of classes A, B, C and I want to have access instances of them from generic code by type, f.e
template
newObject()
{
retur
You can also compute the position of the type with a constexpr function if you don't like template.
constexpr int count_first_falses() { return 0; }
template
constexpr int count_first_falses(bool b1, B... b)
{
if (b1) return 0;
else return 1 + count_first_falses(b...);
}
template
decltype(auto) tuple_get_by_type(const std::tuple& tuple)
{
return std::get::value)...)>(tuple);
}