Hi, i need help here , av gotta snippet here and i need to identify what causes the error.
1 2 3 4 5 6 7 8
template<typename T>
using ret_tuple=std::tuple<std::vector<std::size_t>,std::vector<std::string>,std::vector<T>>;
template<typename ... CONT,typename T>
ret_tuple my_collection(const CONT&&... conts<T>)///error on return type
{
///.... code here
}
the error occur on the return type of my function {my_collection} i need to know how i can make ret_tuple use the template parameter T from this function
error! invalid use of template name ret_tuple without arg list
Error 2 error C3547: template parameter 'T' cannot be used because it follows a
template parameter pack and cannot be deduced from the function parameters of
'my_collection' c:\users\orion\documents\visual studio 2013\projects\azure\azure.cpp 11 1 Azure
is it possible to pass T the template param from this function to ret_tuple?? i tried this ret_tuple<T> it failed with some other errors.
Maybe you can use std::enable_if or something like that to enforce the types are correct, but for the time being you can just assume the types passed to the function are correct. What you should be worrying about instead is how to extract the containers from conts.
If you are not going to pass the whole template parameter pack (conts) to another function you will have to let the first container be its own parameter and then call the function recursively. You probably also need to create a my_collection version that takes less arguments to stop the recursion. Take a look at the definition of "func()" at http://en.wikipedia.org/wiki/Variadic_template