c ++: error: nenhum tipo chamado 'type' na 'classe std :: result_of <void (* (std :: unordered_map

A seguir, é apenas um programa simples para testar usando dois threads para inserir uma tabela de hash. Para o teste, nenhum bloqueio é usado.

#include <iostream>
#include <unordered_map>
#include <thread>

using namespace std;

void thread_add(unordered_map<int, int>& ht, int from, int to)
{
    for(int i = from; i <= to; ++i)
        ht.insert(unordered_map<int, int>::value_type(i, 0));
}

void test()
{
    unordered_map<int, int> ht;
    thread t[2];

    t[0] = thread(thread_add, ht, 0, 9);
    t[1] = thread(thread_add, ht, 10, 19);

    t[0].join();
    t[1].join();

    std::cout << "size: " << ht.size() << std::endl;
}

int main()
{
    test();
    return 0;
}

No entanto, há erros ao compilá-lo.

$ g++ -std=c++11 -pthread test.cpp
...
/usr/include/c++/4.8.2/functional:1697:61: error: no type named ‘type’ in ‘class std::result_of<void (*(std::unordered_map<int, int>, int, int))(std::unordered_map<int, int>&, int, int)>’
       typedef typename result_of<_Callable(_Args...)>::type result_type;
...

Demorou um pouco, mas ainda não pode corrigi-lo. Obrigado.

questionAnswers(2)

yourAnswerToTheQuestion