Difference between std::unordered_map < K, boost::ptr_deque < T > >'s operator[] (K const &) and emplace
问题 #include <memory> #include <unordered_map> #include <vector> #include <utility> #include <boost/ptr_container/ptr_deque.hpp> struct T { T() = default; T(T const &) = delete; T & operator = (T const &) = delete; T(T &&) = default; T & operator = (T &&) = default; }; using S = boost::ptr_deque < T >; int main() { std::unordered_map < uint32_t, S > testum; // testum.emplace(1u, S()); // testum.insert(std::make_pair(1u, S())); testum[1].push_back(new T()); } In the above example, the commented