关于map的定义: template < class Key, class T, class Compare = less<Key>, class Allocator = allocator<pair<const Key,T> > > class map; 第一个template参数被当做元素的key,第二个template参数被当作元素的value.Map的元素型别Key和T,必须满足以下两个条件:1.key/value必须具备assignable(可赋值…
From: https://www.walletfox.com/course/mapwithcustomclasskey.php If you have ever tried to use a custom class as a key of std::map, most probably you got a compilation error. This article explains why this happens and shows how to make custom classes…