Navigation
API > API/Plugins > API/Plugins/PCG
Description
Sorts array given the accessors and keys of the array. Sort is stable by default. A custom function can be used to extract the index of the elements of the array, and sort ascending or descending by the values associated with that index. CompareLess method can also be provided, method signature needs to follow DefaultStableCompareLess. We need the decltypes on both function types to allow to provide default values for both callbacks. Check DefaultIndexGetter and DefaultStableCompareLess for their signatures.
| Name | PCGAttributeAccessorHelpers::SortByAttribute |
| Type | function |
| Header File | /Engine/Plugins/PCG/Source/PCG/Public/Metadata/Accessors/PCGAttributeAccessorHelpers.h |
| Include Path | #include "Metadata/Accessors/PCGAttributeAccessorHelpers.h" |
namespace PCGAttributeAccessorHelpers
{
template<typename T, typename GetIndexFunc, typename CompareLessFunc>
void PCGAttributeAccessorHelpers::SortByAttribute
(
const IPCGAttributeAccessor & InAccessor,
const IPCGAttributeAccessorKeys & InKeys,
TArray < T > & InArray,
bool bAscending,
GetIndexFunc CustomGetIndex,
CompareLessFunc CompareLess
)
}