From ec867fb93df7533ba875667ca8b0fc219b8a032b Mon Sep 17 00:00:00 2001 From: Tomasz Grabiec Date: Thu, 26 Mar 2015 10:15:40 +0100 Subject: [PATCH] type: Fix _is_byte_order_comparable calculation Because the length preceeds component contents, serialized tuples are not byte order comparable. It breaks lexi ordering. It should be that "abc" < "b", but with length prefix "<3>abc" is greater than "<1>b". Only single element tuples can be byte order capared because they have no length component. Spotted during code review. --- tuple.hh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tuple.hh b/tuple.hh index 0d6f9ad7c5..8dea193642 100644 --- a/tuple.hh +++ b/tuple.hh @@ -47,9 +47,7 @@ public: , _byte_order_equal(std::all_of(_types.begin(), _types.end(), [] (auto t) { return t->is_byte_order_equal(); })) - , _byte_order_comparable(std::all_of(_types.begin(), _types.end(), [] (auto t) { - return t->is_byte_order_comparable(); - })) + , _byte_order_comparable(_types.size() == 1 && _types[0]->is_byte_order_comparable()) { } tuple_type(tuple_type&&) = default;