MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / sort

Function sort

Source/ThirdParty/pugixml/pugixml.cpp:6517–6545  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6515 }
6516
6517 template <typename I, typename Pred> void sort(I begin, I end, const Pred& pred)
6518 {
6519 // sort large chunks
6520 while (end - begin > 32)
6521 {
6522 // find median element
6523 I middle = begin + (end - begin) / 2;
6524 median(begin, middle, end - 1, pred);
6525
6526 // partition in three chunks (< = >)
6527 I eqbeg, eqend;
6528 partition(begin, middle, end, pred, &eqbeg, &eqend);
6529
6530 // loop on larger half
6531 if (eqbeg - begin > end - eqend)
6532 {
6533 sort(eqend, end, pred);
6534 end = eqbeg;
6535 }
6536 else
6537 {
6538 sort(begin, eqbeg, pred);
6539 begin = eqend;
6540 }
6541 }
6542
6543 // insertion sort small chunk
6544 if (begin != end) insertion_sort(begin, end, pred, &*begin);
6545 }
6546PUGI__NS_END
6547
6548// Allocator used for AST and evaluation stacks

Callers 15

indirect_sortFunction · 0.85
calc_medianMethod · 0.85
vector_sortFunction · 0.85
sortMethod · 0.85
uniqueMethod · 0.85
create_quant_tablesFunction · 0.85
resampleFunction · 0.85
setTagsFunction · 0.85
sortTestsFunction · 0.85
type_t xpath_sortMethod · 0.85
remove_duplicatesMethod · 0.85
RefreshMethod · 0.85

Calls 3

partitionFunction · 0.85
insertion_sortFunction · 0.85
medianFunction · 0.70

Tested by

no test coverage detected