view: avoid taking decisions on page_size

This commit is contained in:
Michele Caini
2023-11-10 10:27:36 +01:00
parent 5e8544cfc6
commit e53601e860

View File

@@ -822,21 +822,19 @@ public:
*/
template<typename Func>
void each(Func func) const {
if constexpr(is_applicable_v<Func, decltype(*view->each().begin())>) {
if(view) {
if(view) {
if constexpr(is_applicable_v<Func, decltype(*view->each().begin())>) {
for(const auto pack: view->each()) {
std::apply(func, pack);
}
}
} else if constexpr(Get::traits_type::page_size == 0u) {
for(size_type pos{}, last = size(); pos < last; ++pos) {
func();
}
} else {
if(view) {
} else if constexpr(std::is_invocable_v<Func, decltype(*view->begin())>) {
for(auto &&component: *view) {
func(component);
}
} else {
for(size_type pos = view->size(); pos; --pos) {
func();
}
}
}
}