Navigation
API > API/Runtime > API/Runtime/Core > API/Runtime/Core/Algo > API/Runtime/Core/Algo/Algo__CompareMap
References
| Module | Core |
| Header | /Engine/Source/Runtime/Core/Public/Algo/Compare.h |
| Include | #include "Algo/Compare.h" |
namespace Algo
{
template<typename MapType, typename KeyLessThanType, typename ValueLessThanType>
int Algo::CompareMap
(
const MapType & A,
const MapType & B,
KeyLessThanType KeyLessThan,
ValueLessThanType ValueLessThan
)
}
Remarks
Compares two unique-key maps (e.g. TMap) as if they were sorted arrays of key,value pairs sorted by Key and then by Value (almost, see note on sort order). Does not support multiple values per key (e.g. TMultiMap).
Note on sort order: Maps with a smaller number of elements are considered less than maps with a larger number of elements, no matter what keys are present in each map. This drastically improves performance when comparing maps of different sizes. This is different than would be exepcted from a lexical compare of strings, but it does match the comparison of two numbers represented as a string of digits.
MapType interface: typename KeyType, typename ValueType, IntType Num(), ValueType* Find(const KeyType&), IteratorType
Parameters
| Name | Description |
|---|---|
| A | Left-Hand-Side map container. |
| B | Right-Hand-Side map container. |
| KeyLessThan | bool(const KeyType& A, const KeyType& B) that returns A < B. |
| ValueLessThan | bool(const ValueType& A, const ValueType& B) that returns A < B. |