Переглянути джерело

fix: duplicate instantiation
fix: "fix" iota issues

Sam Jaffe 2 роки тому
батько
коміт
3055d05e65
3 змінених файлів з 7 додано та 6 видалено
  1. 4 0
      include/stream/iota_view.h
  2. 3 3
      include/stream/to.h
  3. 0 3
      test/stream_test.cxx

+ 4 - 0
include/stream/iota_view.h

@@ -21,6 +21,10 @@ public:
   T const & dereference() const { return value_; }
   void increment() { ++value_; }
   bool at_end() const { return value_ == bound_; }
+  // Some weird bug in dependent template instantiation???
+  bool equal_to(iota_iterator const & other) const {
+    return value_ == other.value_;
+  }
   std::ptrdiff_t distance_to(iota_iterator const & other) const {
     return other.value_ - value_;
   }

+ 3 - 3
include/stream/to.h

@@ -42,9 +42,9 @@ template <template <typename...> class C> struct to_range {
 };
 
 template <template <typename...> class C> auto to() { return to_range<C>(); }
-auto to_vector() { return to<std::vector>(); }
-auto to_map() { return to<std::map>(); }
-auto to_set() { return to<std::set>(); }
+inline auto to_vector() { return to<std::vector>(); }
+inline auto to_map() { return to<std::map>(); }
+inline auto to_set() { return to<std::set>(); }
 }
 
 #undef FWD

+ 0 - 3
test/stream_test.cxx

@@ -227,9 +227,6 @@ TEST(StreamTest, CanMapToMemFn) {
 //}
 
 TEST(StreamTest, Iota) {
-  static_assert(iterator::detail::has_distance_to_v<
-                    stream::ranges::iota_iterator<int, int>>,
-                "");
   auto out = views::iota(0, 4) |
              views::transform([](size_t i) { return std::vector(i, i); }) |
              views::join() | ranges::to_vector();