Fix issues with std::range::views using clang and C++20

This commit is contained in:
stefiosif
2024-08-03 13:54:11 +03:00
parent 3951db7ff9
commit 467edb4019
3 changed files with 14 additions and 6 deletions

View File

@@ -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() {