Fix issues with std::range::views using clang and C++20
This commit is contained in:
@@ -70,9 +70,9 @@ template <typename T> void Tarjan<T>::strongConnect(const T &u) {
|
||||
}
|
||||
|
||||
template <typename T> auto Tarjan<T>::execute() {
|
||||
for (const auto &u : std::views::keys(adjList)) {
|
||||
if (V[u].index == -1)
|
||||
strongConnect(u);
|
||||
for (const auto &u : adjList) {
|
||||
if (V[u.first].index == -1)
|
||||
strongConnect(u.first);
|
||||
}
|
||||
return SCCs;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <ostream>
|
||||
#include <ranges>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
@@ -38,8 +39,14 @@ public:
|
||||
std::unordered_map<T, std::unordered_set<T>> adjList;
|
||||
};
|
||||
|
||||
template <typename T> auto Graph<T>::vertices() const {
|
||||
return std::views::keys(adjList);
|
||||
template <typename T>
|
||||
auto Graph<T>::vertices() const {
|
||||
std::vector<T> keys;
|
||||
keys.reserve(adjList.size());
|
||||
for (const auto& pair : adjList) {
|
||||
keys.push_back(pair.first);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
template <typename T> std::uint16_t Graph<T>::V() {
|
||||
|
||||
Reference in New Issue
Block a user