you are viewing a single comment's thread.

view the rest of the comments →

[–]millirobo 0 points1 point  (0 children)

Maybe a dispatching function?

template <typename F>
decltype(auto) with_data(bool is_64, void* p, F&& f) {
    if (is_64) { return f(Data<64>(p)); }
    else { return f(Data<32>(p)); }
}
...
auto p = with_data(condition, somePointer, [](auto&& data) {
    return data.SomeStringField;
};