Browse Source

view: drop <algorithm> (no longer required)

Michele Caini 3 years ago
parent
commit
50e67d7c15
1 changed files with 2 additions and 3 deletions
  1. 2 3
      src/entt/entity/view.hpp

+ 2 - 3
src/entt/entity/view.hpp

@@ -1,7 +1,6 @@
 #ifndef ENTT_ENTITY_VIEW_HPP
 #ifndef ENTT_ENTITY_VIEW_HPP
 #define ENTT_ENTITY_VIEW_HPP
 #define ENTT_ENTITY_VIEW_HPP
 
 
-#include <algorithm>
 #include <array>
 #include <array>
 #include <iterator>
 #include <iterator>
 #include <tuple>
 #include <tuple>
@@ -262,7 +261,7 @@ public:
     basic_view(Get &...get, Exclude &...exclude) noexcept
     basic_view(Get &...get, Exclude &...exclude) noexcept
         : pools{&get...},
         : pools{&get...},
           filter{&exclude...},
           filter{&exclude...},
-          view{(std::min)({&static_cast<const base_type &>(get)...}, [](auto *lhs, auto *rhs) { return lhs->size() < rhs->size(); })} {}
+          view{[](const base_type *first, const auto *...other) { ((first = other->size() < first->size() ? other : first), ...); return first; }(&get...)} {}
 
 
     /**
     /**
      * @brief Constructs a multi-type view from a set of storage classes.
      * @brief Constructs a multi-type view from a set of storage classes.
@@ -272,7 +271,7 @@ public:
     basic_view(std::tuple<Get &...> get, std::tuple<Exclude &...> exclude = {}) noexcept
     basic_view(std::tuple<Get &...> get, std::tuple<Exclude &...> exclude = {}) noexcept
         : pools{std::apply([](auto &...curr) { return std::make_tuple(&curr...); }, get)},
         : pools{std::apply([](auto &...curr) { return std::make_tuple(&curr...); }, get)},
           filter{std::apply([](auto &...curr) { return std::make_tuple(&curr...); }, exclude)},
           filter{std::apply([](auto &...curr) { return std::make_tuple(&curr...); }, exclude)},
-          view{std::apply([](const auto &...curr) { return (std::min)({&static_cast<const base_type &>(curr)...}, [](auto *lhs, auto *rhs) { return lhs->size() < rhs->size(); }); }, get)} {}
+          view{std::apply([](const base_type *first, const auto *...other) { ((first = other->size() < first->size() ? other : first), ...); return first; }, pools)} {}
 
 
     /**
     /**
      * @brief Creates a new view driven by a given component in its iterations.
      * @brief Creates a new view driven by a given component in its iterations.