Interpretation of the BUG problem of STL a few days ago

xiaoxiao2021-03-05  24

http://blog.9cbs.net/yjgx007/Archive/2005/04/08/340381.aspx

In STL, the comparison function (or function object) incurring for the sort function, must be followed: compare functions (or function objects) must define a "strict weak sequenceding) on ​​the elements they compare. In STL Terms 21 (http://www.9cbs.com.cn/program/6533.htm) further explanation: ... To avoid falling into this trap, what you have to remember is comparative functions The return value indicates whether a value defined in this function is greater than the other. The equal value is not a greater than the other, so the comparison function should always return equality to false ... ... Yes, this detail is so important.

It used to think that this is a BUG of STL-sequence function sort, see: http://community.9cbs.net/expert/topic/3920/3920955.xml? Temp = 5.440921E-02

Also specifically to 9CBS (http://community.9cbs.net/expert/topicview.asp?id=3920955) and codeproject (http://www.codeproject.com/script/comments/forums.asp?msg=1082759&Forumid= 4486 # xx1084020xx) Inquiry.

转载请注明原文地址:https://www.9cbs.com/read-34738.html

New Post(0)