Chaining of ordering predicates (e.g. for std::sort)

前端 未结 6 1834
说谎
说谎 2021-02-05 23:33

You can pass a function pointer, function object (or boost lambda) to std::sort to define a strict weak ordering of the elements of the container you want sorted.

Howeve

6条回答
  •  误落风尘
    2021-02-06 00:18

    The chaining solution is verbose. You could also use boost::bind in conjunction with std::logical_and to build your sorting predicate. See the linked article for more information: How the boost bind library can improve your C++ programs

提交回复
热议问题