class TestClass {
public:
TestClass(string s) {
}
};
当有 TestClass 时,我理解 emplace 和 insert 之间的区别(在插入副本时将结构放置在适当的位置)
set<TestClass> test_set;
test_set.insert(TestClass("d"));
test_set.emplace("d");
但是,如果已经有一个 TestClass 对象,那么它们在机制和性能方面有何不同?
set<TestClass> test_set;
TestClass tc("e");
test_set.insert(tc);
test_set.emplace(tc);