[libcxx-commits] [libcxx] f75f171 - [libc++] Remove cpp17_input_iterator.h
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 15 19:17:54 PST 2022
Author: Nikolas Klauser
Date: 2022-02-16T04:17:40+01:00
New Revision: f75f171b2050660a76d1458bf967a748770d54cc
URL: https://github.com/llvm/llvm-project/commit/f75f171b2050660a76d1458bf967a748770d54cc
DIFF: https://github.com/llvm/llvm-project/commit/f75f171b2050660a76d1458bf967a748770d54cc.diff
LOG: [libc++] Remove cpp17_input_iterator.h
Reviewed By: Quuxplusone, #libc
Spies: libcxx-commits
Differential Revision: https://reviews.llvm.org/D119881
Added:
Modified:
libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
libcxx/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
Removed:
libcxx/test/std/strings/basic.string/cpp17_input_iterator.h
################################################################################
diff --git a/libcxx/test/std/strings/basic.string/cpp17_input_iterator.h b/libcxx/test/std/strings/basic.string/cpp17_input_iterator.h
deleted file mode 100644
index 14512a72671f9..0000000000000
--- a/libcxx/test/std/strings/basic.string/cpp17_input_iterator.h
+++ /dev/null
@@ -1,40 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef INPUT_ITERATOR_H
-#define INPUT_ITERATOR_H
-
-#include <iterator>
-
-template <class It>
-class cpp17_input_iterator
-{
- It it_;
-public:
- typedef typename std::input_iterator_tag iterator_category;
- typedef typename std::iterator_traits<It>::value_type value_type;
- typedef typename std::iterator_traits<It>::
diff erence_type
diff erence_type;
- typedef It pointer;
- typedef typename std::iterator_traits<It>::reference reference;
-
- cpp17_input_iterator() : it_() {}
- explicit cpp17_input_iterator(It it) : it_(it) {}
-
- reference operator*() const {return *it_;}
- pointer operator->() const {return it_;}
-
- cpp17_input_iterator& operator++() {++it_; return *this;}
- cpp17_input_iterator operator++(int) {cpp17_input_iterator tmp(*this); ++(*this); return tmp;}
-
- friend bool operator==(const cpp17_input_iterator& x, const cpp17_input_iterator& y)
- {return x.it_ == y.it_;}
- friend bool operator!=(const cpp17_input_iterator& x, const cpp17_input_iterator& y)
- {return !(x == y);}
-};
-
-#endif // INPUT_ITERATOR_H
diff --git a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
index e3994331aa268..e08d6dd547820 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc.pass.cpp
@@ -20,7 +20,7 @@
#include "test_macros.h"
#include "test_allocator.h"
-#include "../cpp17_input_iterator.h"
+#include "test_iterators.h"
#include "min_allocator.h"
template <class It>
@@ -34,8 +34,11 @@ test(It first, It last)
LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == static_cast<std::size_t>(std::distance(first, last)));
unsigned i = 0;
- for (It it = first; it != last; ++it, ++i)
+ for (It it = first; it != last;) {
assert(s2[i] == *it);
+ ++it;
+ ++i;
+ }
assert(s2.get_allocator() == A());
assert(s2.capacity() >= s2.size());
}
@@ -50,8 +53,11 @@ test(It first, It last, const A& a)
LIBCPP_ASSERT(s2.__invariants());
assert(s2.size() == static_cast<std::size_t>(std::distance(first, last)));
unsigned i = 0;
- for (It it = first; it != last; ++it, ++i)
+ for (It it = first; it != last;) {
assert(s2[i] == *it);
+ ++it;
+ ++i;
+ }
assert(s2.get_allocator() == a);
assert(s2.capacity() >= s2.size());
}
diff --git a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
index d651bbfe2cc39..74d98a976bb60 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/iter_alloc_deduction.pass.cpp
@@ -31,7 +31,6 @@
#include "test_macros.h"
#include "test_allocator.h"
-#include "../cpp17_input_iterator.h"
#include "min_allocator.h"
bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
index 271d966d06e82..1dff75c9c9a41 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/string_view_deduction.pass.cpp
@@ -33,7 +33,6 @@
#include "test_macros.h"
#include "test_allocator.h"
-#include "../cpp17_input_iterator.h"
#include "min_allocator.h"
bool test() {
diff --git a/libcxx/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp b/libcxx/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
index 2fe93654fca3c..e36fa2c3b2b06 100644
--- a/libcxx/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
+++ b/libcxx/test/std/strings/basic.string/string.cons/string_view_size_size_deduction.pass.cpp
@@ -37,7 +37,6 @@
#include "test_macros.h"
#include "test_allocator.h"
-#include "../cpp17_input_iterator.h"
#include "min_allocator.h"
bool test() {
More information about the libcxx-commits
mailing list