[#BloombergLP-bdlb-TopologicalSortUtil_Helper-sortImpl]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlb.adoc[bdlb]::xref:BloombergLP/bdlb/TopologicalSortUtil_Helper.adoc[TopologicalSortUtil&lowbar;Helper]::sortImpl
:relfileprefix: ../../../
:mrdocs:

Sort constructed inputs into topological order&period;

== Synopsis

Declared in `&lt;bdlb&lowbar;topologicalsortutil&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
template&lt;
    class OUTPUT&lowbar;ITER,
    class UNSORTED&lowbar;OUT&lowbar;ITER&gt;
bool
sortImpl(
    OUTPUT&lowbar;ITER resultOutIter,
    UNSORTED&lowbar;OUT&lowbar;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`&period; 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`&period; See `TopologicalSortUtil&colon;&colon;sort` &quot;iterators overload&quot; for more detailed specification&period;

== Return Value

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

== Parameters

[cols="1,4"]
|===
| Name| Description
| *resultOutIter*
| output iterator for the ordered nodes
| *unsortedOutIter*
| output iterator for unsorted nodes on failure
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
