#include <list>
#include <tuple>
struct RawTable { };
struct Table
{
template<class Type>
struct Meta
{
Meta(const char * columnName) : columnName(columnName) { }
using type = Type;
const char * const columnName;
// . . .
};
template<class... MetaArgs>
static inline
auto parse(RawTable&&, MetaArgs&&...) -> std::list<std::tuple<typename MetaArgs::type...>>
{
return std::list<std::tuple<typename MetaArgs::type...>>();
}
};
int main()
{
for (std::tuple<bool,int> & tuple : Table::parse(RawTable(),
Table::Meta<bool>("field1"),
Table::Meta<int>("field2")))
{
(void)tuple;
//TODO
}
return 0;
}
I2luY2x1ZGUgPGxpc3Q+CiNpbmNsdWRlIDx0dXBsZT4KCnN0cnVjdCBSYXdUYWJsZSB7IH07CgpzdHJ1Y3QgVGFibGUKewoJdGVtcGxhdGU8Y2xhc3MgVHlwZT4gCglzdHJ1Y3QgTWV0YQoJewoJCU1ldGEoY29uc3QgY2hhciAqIGNvbHVtbk5hbWUpIDogY29sdW1uTmFtZShjb2x1bW5OYW1lKSB7IH0KCgkJdXNpbmcgdHlwZSA9IFR5cGU7CgkJY29uc3QgY2hhciAqIGNvbnN0IGNvbHVtbk5hbWU7CgkJLy8gLiAuIC4KCX07CgoJdGVtcGxhdGU8Y2xhc3MuLi4gTWV0YUFyZ3M+CglzdGF0aWMgaW5saW5lCglhdXRvIHBhcnNlKFJhd1RhYmxlJiYsIE1ldGFBcmdzJiYuLi4pIC0+IHN0ZDo6bGlzdDxzdGQ6OnR1cGxlPHR5cGVuYW1lIE1ldGFBcmdzOjp0eXBlLi4uPj4KCXsKCQlyZXR1cm4gc3RkOjpsaXN0PHN0ZDo6dHVwbGU8dHlwZW5hbWUgTWV0YUFyZ3M6OnR5cGUuLi4+PigpOwoJfQp9OwoKaW50IG1haW4oKQp7Cglmb3IgKHN0ZDo6dHVwbGU8Ym9vbCxpbnQ+ICYgdHVwbGUgOiBUYWJsZTo6cGFyc2UoUmF3VGFibGUoKSwgCgkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgVGFibGU6Ok1ldGE8Ym9vbD4oImZpZWxkMSIpLAoJICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFRhYmxlOjpNZXRhPGludD4oImZpZWxkMiIpKSkKCXsKCQkodm9pZCl0dXBsZTsKCQkvL1RPRE8KCX0KCglyZXR1cm4gMDsKfQo=