Why do you want to put that type in a struct? It's not really designed to be used like that (I should know, I wrote it!) but if necessary you can use decltype
and std::declval
to determine the type (which will still give the right answer if I change the implementation of redi::zip
)
struct EventData
{
// type returned by redi::zip
typedef decltype(redi::zip(std::declval<V1>(), std::declval<V2>())) zipper_type;
// type referred to by zipper_type::iterator
typedef std::iterator_traits<zipper_type::iterator>::value_type zipped_type;
zipper_type m_zipper;
};
N.B. why are you creating a typedef
for the struct
? This is C++ not C, stop it.
I have no idea what the type of auto i is, making it harder to reuse expertise and learn from examples.
Get used to it. Do you know the type that std::bind
returns? Do you know the type that std::mem_fn
returns? Do you know the type that a lambda expression creates? No, you don't need to know, all you need to know is what properties it has and what you can do with it, not what it's called or what types it contains.