pub enum MapKeyOrdering {
SignedInteger,
UnsignedInteger,
EnumeratorValue,
CodeUnits,
}Expand description
How a map key’s values are compared when
MapEntryOrder::AscendingKey puts the entries in order.
The answer crate::map_key_ordering gives, and the one thing the
three language columns have to agree on beyond “sorted”: a signed and
an unsigned reading of the same octets give different orders, and the
corpus separates them — see MapEntryOrder.
It is deliberately not “compare the encoded octets”. A negative
long key encodes as ffed2979, which sorts last among the octets
and first among the values, and Fast DDS writes it first.
Variants§
SignedInteger
By signed integer value — int8, short, long, long long,
and an IDL char, whose C++ counterpart is signed on the host
the corpus was recorded on.
UnsignedInteger
By unsigned integer value — octet, uint8, unsigned short,
unsigned long, unsigned long long, boolean (false before
true) and wchar (by code point).
EnumeratorValue
By the enumerator’s declared value, signed.
enum class E : int32_t under std::less is the underlying
integer, and @value gives it. Unmeasured against recorded
octets — see MapEntryOrder.
CodeUnits
By the text’s code units, compared unsigned, shorter first on a prefix.
For a string this is std::string::operator<, which is
char_traits<char>::compare and which C++ defines over
unsigned char whatever char’s own signedness is.
map-key-string measures it: ["", "alpha", "üሴ"] stays as
declared, and a signed reading of üሴ’s leading c3 would put
that entry first.
For a wstring this is std::wstring::operator<, which compares
code points. One variant and not two, because the two orders
are the same order: every column here holds a wstring as UTF-8
— zd_wstring is a const char *, the Python column holds a
str and the Rust probe a String — and UTF-8 is order
preserving, so the unsigned octet order of a UTF-8 encoding is
the code-point order of what it encodes. Splitting the variant
would give a coordinate no value could separate, which is a
distinction a mutation cannot make red. No corpus case declares a
wstring map key.