If I have some 3D container, which can be the combination of any containing types out there. and I have to write a generic function which receives this container as an argument, and has to return a 2D container (a matrix) that is the same type as the elements of the 3D container.
For expample, the 3D container received:
std::vector<std::deque<std::deque<int>>> 3D;
The returned type:
std::deque<std::deque<int>>
How can I achieve this, and make the return type generic and dependent on the multidimensional container that has been received? Lets say I have a generic function that receives a 3D container, and has to return the same type that the 3D container contains. For example: my function is like this:
template<typename 3D>
auto Function(3D Knt)-> decltype(0+Knt[0]){
// randome code
decltype(0+Knt[0]) K;
// randome code
return K;
}
Will this cause any errors?