Operator< and strict weak ordering

前端 未结 6 1915
醉酒成梦
醉酒成梦 2020-11-22 03:51

How to define operator< on n-tuple (for example on 3-tuple) so that it satisfy strict weak ordering concept ? I know that boost library has

6条回答
  •  广开言路
    2020-11-22 04:29

    You could simply use three-element vectors, which will already have operator<() suitably defined. This has the advantage that it extends to N-elements without you having to do anything.

提交回复
热议问题