Stop trying to make <ranges> happen, it's not going to happen

This commit is contained in:
Luke Street 2021-10-25 22:34:12 -04:00
parent 45f56d21f1
commit 2f53b21740
1 changed files with 6 additions and 7 deletions

View File

@ -5,7 +5,6 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif #endif
#include <windows.h> #include <windows.h>
#include <ranges>
#else #else
#include <dirent.h> #include <dirent.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -83,8 +82,8 @@ DirectoryEnumerator::DirectoryEnumerator(std::string_view path, Mode mode, bool
m_entries.reserve(sort.size()); m_entries.reserve(sort.size());
if (reverse) { if (reverse) {
for (auto& it : std::ranges::reverse_view(sort)) { for (auto it = sort.crbegin(); it != sort.crend(); ++it) {
m_entries.emplace_back(std::move(it.second)); m_entries.emplace_back(std::move(it->second));
} }
} else { } else {
for (auto& e : sort) { for (auto& e : sort) {
@ -125,8 +124,8 @@ DirectoryEnumerator::DirectoryEnumerator(std::string_view path, Mode mode, bool
m_entries.reserve(m_entries.size() + sort.size()); m_entries.reserve(m_entries.size() + sort.size());
if (reverse) { if (reverse) {
for (auto& it : std::ranges::reverse_view(sort)) { for (auto it = sort.crbegin(); it != sort.crend(); ++it) {
m_entries.emplace_back(std::move(it.second)); m_entries.emplace_back(std::move(it->second));
} }
} else { } else {
for (auto& e : sort) { for (auto& e : sort) {
@ -155,8 +154,8 @@ DirectoryEnumerator::DirectoryEnumerator(std::string_view path, Mode mode, bool
m_entries.reserve(m_entries.size() + sort.size()); m_entries.reserve(m_entries.size() + sort.size());
if (reverse) { if (reverse) {
for (auto& e : std::ranges::reverse_view(sort)) { for (auto it = sort.crbegin(); it != sort.crend(); ++it) {
m_entries.emplace_back(std::move(e.second)); m_entries.emplace_back(std::move(it->second));
} }
} else { } else {
for (auto& e : sort) { for (auto& e : sort) {