diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-27 17:56:06 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-04-27 18:59:57 -0700 |
| commit | 75e8752cb90eb8bc7717518d9d6a5c68f27f2b0f (patch) | |
| tree | b3a8c01beebba2b7e5524363b59bfc088aab83a2 /toolsrc/include/vcpkg_Graphs.h | |
| parent | db2bc7ed80cd85935bcf80a02a06c796d01197b7 (diff) | |
| download | vcpkg-75e8752cb90eb8bc7717518d9d6a5c68f27f2b0f.tar.gz vcpkg-75e8752cb90eb8bc7717518d9d6a5c68f27f2b0f.zip | |
Run clang-format over the headers. Remove stray Version.h/cpp. Fix location of VersionT.cpp
Diffstat (limited to 'toolsrc/include/vcpkg_Graphs.h')
| -rw-r--r-- | toolsrc/include/vcpkg_Graphs.h | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/toolsrc/include/vcpkg_Graphs.h b/toolsrc/include/vcpkg_Graphs.h index 97cd29236..3c8c024c2 100644 --- a/toolsrc/include/vcpkg_Graphs.h +++ b/toolsrc/include/vcpkg_Graphs.h @@ -16,7 +16,7 @@ namespace vcpkg::Graphs FULLY_EXPLORED }; - template <class V, class U> + template<class V, class U> __interface AdjacencyProvider { std::vector<V> adjacency_list(const U& vertex) const; @@ -24,7 +24,7 @@ namespace vcpkg::Graphs U load_vertex_data(const V& vertex) const; }; - template <class V, class U> + template<class V, class U> static void topological_sort_internal(const V& vertex, const AdjacencyProvider<V, U>& f, std::unordered_map<V, ExplorationStatus>& exploration_status, @@ -33,27 +33,24 @@ namespace vcpkg::Graphs ExplorationStatus& status = exploration_status[vertex]; switch (status) { - case ExplorationStatus::FULLY_EXPLORED: - return; - case ExplorationStatus::PARTIALLY_EXPLORED: - Checks::exit_with_message(VCPKG_LINE_INFO, "cycle in graph"); + case ExplorationStatus::FULLY_EXPLORED: return; + case ExplorationStatus::PARTIALLY_EXPLORED: Checks::exit_with_message(VCPKG_LINE_INFO, "cycle in graph"); case ExplorationStatus::NOT_EXPLORED: - { - status = ExplorationStatus::PARTIALLY_EXPLORED; - U vertex_data = f.load_vertex_data(vertex); - for (const V& neighbour : f.adjacency_list(vertex_data)) - topological_sort_internal(neighbour, f, exploration_status, sorted); + { + status = ExplorationStatus::PARTIALLY_EXPLORED; + U vertex_data = f.load_vertex_data(vertex); + for (const V& neighbour : f.adjacency_list(vertex_data)) + topological_sort_internal(neighbour, f, exploration_status, sorted); - sorted.push_back(std::move(vertex_data)); - status = ExplorationStatus::FULLY_EXPLORED; - return; - } - default: - Checks::unreachable(VCPKG_LINE_INFO); + sorted.push_back(std::move(vertex_data)); + status = ExplorationStatus::FULLY_EXPLORED; + return; + } + default: Checks::unreachable(VCPKG_LINE_INFO); } } - template <class V, class U> + template<class V, class U> std::vector<U> topological_sort(const std::vector<V>& starting_vertices, const AdjacencyProvider<V, U>& f) { std::vector<U> sorted; |
