How can I use std::maps with user-defined types as key?

前端 未结 7 1772
灰色年华
灰色年华 2020-11-22 04:30

I\'m wondering why I can\'t use STL maps with user-defined classes. When I compile the code below, I get the following cryptic error message. What does it mean? Also, why is

7条回答
  •  独厮守ぢ
    2020-11-22 04:56

    Keys must be comparable, but you haven't defined a suitable operator< for your custom class.

提交回复
热议问题