std::map<>::insert using non-copyable objects and uniform initialization

后端 未结 2 1437
慢半拍i
慢半拍i 2020-12-06 10:43

Have a look at the following code:

#include 
#include 

// non-copyable but movable
struct non_copyable {
    non_copyable() = defa         


        
2条回答
  •  星月不相逢
    2020-12-06 11:12

    [This is a complete rewrite. My earlier answer had nothing to do with the problem.]

    The map has two relevant insert overloads:

    • insert(const value_type& value), and