MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / sort

Method sort

src/common/classes/array.h:607–626  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605 }
606
607 void sort()
608 {
609 if (sorted)
610 return;
611
612 auto compare = [] (const void* a, const void* b) {
613 const Key& first(KeyOfValue::generate(*static_cast<const Value*>(a)));
614 const Key& second(KeyOfValue::generate(*static_cast<const Value*>(b)));
615
616 if (Cmp::greaterThan(first, second))
617 return 1;
618 if (Cmp::greaterThan(second, first))
619 return -1;
620
621 return 0;
622 };
623
624 qsort(this->begin(), this->getCount(), sizeof(Value), compare);
625 sorted = true;
626 }
627
628private:
629 int sortMode;

Callers 1

parseMethod · 0.45

Calls 2

beginMethod · 0.45
getCountMethod · 0.45

Tested by

no test coverage detected