#include <memory>
#include <list>
#include <unordered_map>
class ClsA {
};
typedef std::list<ClsA*> ClsAList;
typedef std::unordered_map< int, std::unique_ptr < ClsAList> > ClsAListMap;
ClsAListMap map;
void Insert(int id, ClsA *a) {
auto list = new ClsAList{ a };
std::unique_ptr<ClsAList> smart_list(list);
//compilation error here
map.insert(id, smart_list);//error
map.insert({ a, smart_list});//error
}
Due to the multi level of template, the error tip is not readable at all, what's wrong here?
By the way, how to use make_unique
in this situation? I've try it without success, only lengthy error tip nightmares.