From 2d6e8f096b73d99ceeb75db93ee312d42f2e7db8 Mon Sep 17 00:00:00 2001 From: Wouter van Oortmerssen Date: Mon, 13 Feb 2017 09:49:16 -0800 Subject: [PATCH] Fixed sorting assertion with some std::sort implementations. Change-Id: Idd925c9cc5cd2a35e06f4d832734180f5c38378e Tested: on Linux. --- include/flatbuffers/flexbuffers.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/flatbuffers/flexbuffers.h b/include/flatbuffers/flexbuffers.h index 242a53655..bd2be0def 100644 --- a/include/flatbuffers/flexbuffers.h +++ b/include/flatbuffers/flexbuffers.h @@ -912,7 +912,9 @@ class Builder FLATBUFFERS_FINAL_CLASS { auto comp = strcmp(as, bs); // If this assertion hits, you've added two keys with the same value to // this map. - assert(comp); + // TODO: Have to check for pointer equality, as some sort implementation + // apparently call this function with the same element?? Why? + assert(comp || &a == &b); return comp < 0; }); // First create a vector out of all keys.