sort overloads

Synopses

Declared in <bdlb_topologicalsortutil.h>

Sort nodes into topological order given edge relations.

template<class NODE_TYPE>
static
bool
sort(
    bsl::vector<NODE_TYPE>* result,
    bsl::vector<NODE_TYPE>* unsorted,
    bsl::vector<bsl::pair<NODE_TYPE, NODE_TYPE>> const& relations);

Sort input edges into topological order via output iterators.

template<
    class INPUT_ITER,
    class OUTPUT_ITER,
    class UNSORTED_OUTPUT_ITER>
static
bool
sort(
    INPUT_ITER relationsBegin,
    INPUT_ITER relationsEnd,
    OUTPUT_ITER resultOutIter,
    UNSORTED_OUTPUT_ITER unsortedOutIter);

Return Value

true if the sort succeeds, and false if a cycle is found

Parameters

Name

Description

result

destination for the ordered nodes

unsorted

destination for nodes left unsorted on failure

relations

directed edges (U, V) where U precedes V

relationsBegin

beginning of the input edge range

relationsEnd

end of the input edge range

resultOutIter

output iterator for the ordered nodes

unsortedOutIter

output iterator for unsorted nodes on failure

Created with MrDocs