error C2678

自定义结构类型,为支持插入到stl set或者排序,一种方式是重载operator<运算符成员函数.如果忘记将函数标识为const,则在编译时会报

6>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xfunctional(125): error C2678: binary '<' : no operator found which takes a left-hand operand of type 'const YourOwnItem' (or there is no acceptable conversion)

将函数改为const即可

posted @ 2016-05-28 17:41  715776681  阅读(546)  评论(0编辑  收藏  举报