Domanda

Can you see anything wrong with this function declaration?

template<typename... Containers>
std::tuple<typename Containers::value_type...>
foo(const Containers &...args);

When I try to call it, like this:

foo(std::list<int>(), std::vector<float>());

MSVC2013 says error C2027: use of undefined type 'std::tuple<Containers::value_type>.

I tried rewriting the function declaration with the "late return" syntax and it made no difference.

Is there any way I can achieve what this code is trying to do?

È stato utile?

Soluzione

You won the right to fill a bug report on microsoft connect… The code is ok on clang and gcc.

A workaround on VS2013 and maybe gcc 4.7 :

template <typename T>
using ValueType = typename T::value_type;

template<typename... Containers>
std::tuple<ValueType<Containers>...>
foo( const Containers &...args ) { return {}; }
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top