I've struct like that: struct Foo { int a_1; float a_2; string a_3; string b_1; double b_2; }
I would like to transparently access that like: foo.a.first foo.b.second = "baz"; with an helper like: auto a(...) { ... } auto b(...) { ... } that can be used also in functions that are expecting it: void worksOnA( .... ) { } void worksOnB( .... ) { } auto foo = Foo( ... ) foo.a.worksOnA(); foo.b.worksOnB(); But I'm struggling in finding a good way to do it... Suggestions? Thanks! /Paolo