refactor: use std::ranges whenever possible (#10584)

This commit is contained in:
Kamikadze 2025-05-30 18:25:59 +05:00 committed by GitHub
parent 9bf1b49144
commit 9190443d95
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 137 additions and 146 deletions

View file

@ -26,7 +26,7 @@ void CLayoutManager::switchToLayout(std::string layout) {
}
bool CLayoutManager::addLayout(const std::string& name, IHyprLayout* layout) {
if (std::find_if(m_layouts.begin(), m_layouts.end(), [&](const auto& other) { return other.first == name || other.second == layout; }) != m_layouts.end())
if (std::ranges::find_if(m_layouts, [&](const auto& other) { return other.first == name || other.second == layout; }) != m_layouts.end())
return false;
m_layouts.emplace_back(std::make_pair<>(name, layout));
@ -37,7 +37,7 @@ bool CLayoutManager::addLayout(const std::string& name, IHyprLayout* layout) {
}
bool CLayoutManager::removeLayout(IHyprLayout* layout) {
const auto IT = std::find_if(m_layouts.begin(), m_layouts.end(), [&](const auto& other) { return other.second == layout; });
const auto IT = std::ranges::find_if(m_layouts, [&](const auto& other) { return other.second == layout; });
if (IT == m_layouts.end() || IT->first == "dwindle" || IT->first == "master")
return false;