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.
This commit is contained in:
Tomasz Grabiec
2015-03-26 10:15:40 +01:00
parent 7a6dd463dd
commit ec867fb93d

View File

@@ -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;