I’m having an issue with a seemingly complicated problem.
I’m trying to make an iterator class for a zip function (trying to mimic python’s generator zip function).
I have the entire class at http://ideone.com/c7rm40
template<size_t I = 0, typename... Tp>
inline typename std::enable_if<(I == sizeof...(Tp)), typename std::tuple<decltype(*Tp)...>>::type
constructImpl(std::tuple<Tp...> const& its) {
core/StarAlgorithm.hpp|550 col 3| error: expected ‘(’ before ‘constructImpl’
core/StarAlgorithm.hpp|550 col 3| error: expected ‘>’ before ‘constructImpl’
core/StarAlgorithm.hpp|550 col 45| error: template argument 2 is invalid
core/StarAlgorithm.hpp|550 col 47| error: expected ‘::’ before ‘{’ token
core/StarAlgorithm.hpp|550 col 47| error: expected identifier before ‘{’ token
core/StarAlgorithm.hpp|550 col 47| error: expected unqualified-id before ‘{’ token
My question is, is this approach even valid? I can’t figure out why it’s necessarily wrong, or what the compiler wants from me.
But beyond that, if there is a simpler approach I am missing, I would be overjoyed to hear it.
I’m guessing the problem is that
*Tpis not a valid expression fordecltype.Maybe try
declval?Or iterator traits: