Quellcode durchsuchen

container: constrain iterator types

skypjack vor 1 Monat
Ursprung
Commit
504768ffb3
2 geänderte Dateien mit 4 neuen und 2 gelöschten Zeilen
  1. 2 1
      src/entt/container/dense_map.hpp
  2. 2 1
      src/entt/container/dense_set.hpp

+ 2 - 1
src/entt/container/dense_map.hpp

@@ -4,6 +4,7 @@
 #include <bit>
 #include <cmath>
 #include <compare>
+#include <concepts>
 #include <cstddef>
 #include <functional>
 #include <iterator>
@@ -547,7 +548,7 @@ public:
      * @param first An iterator to the first element of the range of elements.
      * @param last An iterator past the last element of the range of elements.
      */
-    template<typename It>
+    template<std::input_iterator It>
     void insert(It first, It last) {
         for(; first != last; ++first) {
             insert(*first);

+ 2 - 1
src/entt/container/dense_set.hpp

@@ -4,6 +4,7 @@
 #include <bit>
 #include <cmath>
 #include <compare>
+#include <concepts>
 #include <cstddef>
 #include <functional>
 #include <iterator>
@@ -524,7 +525,7 @@ public:
      * @param first An iterator to the first element of the range of elements.
      * @param last An iterator past the last element of the range of elements.
      */
-    template<typename It>
+    template<std::input_iterator It>
     void insert(It first, It last) {
         for(; first != last; ++first) {
             insert(*first);