I develop small reflection library for studying purpose. I want to traverse all fields of some C++ class. There is guarantee, that this class implement reflect function. The full example of such class is:
struct some_class
{
    char field1;
    bool field2;
    some_class()
        : field1(0)
        , field2(0)
    {
    }
};
template<class proc>
void reflect(proc& p, some_class& sc)
{
    reflect(p, sc.field1, "field1");
    reflect(p, sc.field2, "field2");
}
I want to traverse all the fields of this class and perform some action for each of field. For example, I may print field or serialize it.
I think I need to implement Visitor pattern. I also think that the Generic lambdas (С++ 14) help me too.
auto lambda = [](auto x, auto y) {return x + y;};
I do not know how to solve my task. I look forward to any advice.
Note, that the signature of reflect function is immutable. I cannot change it.