BloombergLP::bdlb::TopologicalSortUtil_Helper::sortImpl

Sort constructed inputs into topological order.

Synopsis

Declared in <bdlb_topologicalsortutil.h>

template<
    class OUTPUT_ITER,
    class UNSORTED_OUT_ITER>
bool
sortImpl(
    OUTPUT_ITER resultOutIter,
    UNSORTED_OUT_ITER unsortedOutIter);

Description

Sort the input elements provided during construction in topological order and write the resulting linear ordered set into the specified resultOutIter and return true. If the sort is unsuccessful (the input is not an acyclic directed graph) write the nodes that have not been sorted to the specified unsortedOutIter output and return false. See TopologicalSortUtil::sort "iterators overload" for more detailed specification.

Return Value

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

Parameters

NameDescription
resultOutIteroutput iterator for the ordered nodes
unsortedOutIteroutput iterator for unsorted nodes on failure