Hi All, I'm trying to implement a function that allows me to make a call like this
// veca is a vector of tuples in my case
columnViewOfTuple<0>(veca);
I implemented such function as follows
template<int N>
struct myfunction {
template<typename T, typename R>
std::vector<R> operator() (T& container)
{
std::vector<R> myvector;
for(typename T::iterator it = container.begin(); it!=container.end(); it++)
myvector.push_back((R)(*it).template get<N>());
return myvector;
}
};
whenever I call myfunction<0>(vec5), where vec5 is some vector of tuples, it says
main.cpp: In function 'int main()': main.cpp:156: error: conflicting declaration 'myfunction<0> vec5' main.cpp:155: error: 'vec5' has a previous declaration as 'main()::vec1_t vec5'
Do you guys know how to fix this?
Thanks