Reformulate constexpr_min and constexpr_max to achieve stability in sorting as descri...
authorEric Niebler <eniebler@fb.com>
Mon, 5 Dec 2016 20:51:19 +0000 (12:51 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Mon, 5 Dec 2016 20:53:31 +0000 (12:53 -0800)
commit87efa7eedee6e11a9c6083726a2de855891052b0
tree72eff50da248ecce584d2acc268058d5c6006846
parentfae84c77f3cd88d9e7ccfc39a1fa04ad80f7f540
Reformulate constexpr_min and constexpr_max to achieve stability in sorting as described in stepanovpapers.com/notes.pdf

Summary: There is a famous long-standing "bug" in the standard library regarding the semantics of min and max wrt values that are equivalent wrt op< but not equal. Let's not make the same mistake with constexpr_min and constexpr_max.

Reviewed By: yfeldblum, luciang, Orvid, ot

Differential Revision: D4269635

fbshipit-source-id: 19b464c949dc0cf07afb08eaf657ae8b242ca42d
folly/portability/Constexpr.h