The sample code is:
#include <unordered_map>
int main() {
std::unordered_map<int, std::pair<int, int>> map;
map.emplace(1, {1, 1});
return 0;
}
Where the emplace()
has signature, like:
template <class... _Args>
pair<iterator, bool> emplace(_Args&&... __args);
The gcc
says that function expectes 0 arguments - 2 provided. The clang
says that function expects 1 argument - 2 provided.
I don't even understand - what the problem is with this code?
The problem is that {1, 1}
is not an expression and has no type. Since it has no type, it cannot be deduced into the template argument list. Neither of them are correct, because the issue has nothing to do with the number of arguments provided.