Consider the following code:
#include <tuple>
template <typename Map, typename K>
void mymapfunc(Map& m, const K& key)
{
m[key] = 1;
}
void f()
{
typedef std::tuple<int,int> Pair;
std::map<Pair,int> m;
mymapfunc(m, Pair(1,2));
}
This code does not work in VC ++ 2010, but compiles in gcc 4.5 (without warning with -Wall and -pedantic). The error is somewhere inside <tuple>and hard to decipher.
If std::tuplechanged to std::pair, everything will work. What's going on here?
source
share