[llvm] [llvm][Object] Add missing const qualifier for value_type in content_iterator (PR #124106)
Bushev Dmitry via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 27 09:23:56 PST 2025
================
@@ -38,3 +40,24 @@ TEST(Object, DataRefImplOstream) {
EXPECT_EQ(Expected, s);
}
+
+struct ProxyContent {
+ unsigned Index = 0;
+ ProxyContent(unsigned Index) : Index(Index) {};
+ void moveNext() { Index++; }
+
+ bool operator==(const ProxyContent &Another) const {
+ return Index == Another.Index;
+ }
+};
+
+TEST(Object, ContentIterator) {
+ using Iter = llvm::object::content_iterator<ProxyContent>;
+ auto Sequence = llvm::make_range(Iter(0u), Iter(10u));
+ auto EvenSequence = llvm::make_filter_range(
+ Sequence, [](auto &&PC) { return PC.Index % 2 == 0; });
+
+ for (auto &&[I, Value] : llvm::enumerate(EvenSequence)) {
----------------
dybv-sc wrote:
done
https://github.com/llvm/llvm-project/pull/124106
More information about the llvm-commits
mailing list