#include <iostream>
#include <memory>
#include <map>

struct method {
	virtual ~method() { std::cout << "f\n"; };
};
typedef std::unique_ptr<method> MPTR;

std::map<int, MPTR> tbl;

void insert(int id, MPTR m) {
	tbl.insert(std::make_pair(id, std::move(m)));
};

void set(int id, MPTR m) {
	tbl[id] = std::move(m);
};

int main()
{
	insert(1, MPTR(new method)); // or insert(1, std:::make_unique<method>()) in C++14 and later
	set(1, MPTR(new method)); // or set(1, std:::make_unique<method>()) in C++14 and later
	return 0;                                                                                                                               
}