[libcxx-commits] [libcxx] [libc++] added benchmarks for `string::append()` (PR #213990)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Fri Aug 7 00:20:22 PDT 2026


================
@@ -43,6 +43,25 @@ void bench(std::string name, Func func, Mod modifier = {}) {
 #endif
 }
 
+template <typename Iterator>
+struct unoptimizable_forward_iterator : Iterator {
+  using iterator_category = std::forward_iterator_tag;
+
+  unoptimizable_forward_iterator(Iterator i) : Iterator{i} {}
+
+  _LIBCPP_NOINLINE unoptimizable_forward_iterator& operator++() {
+    ++static_cast<Iterator&>(*this);
+    return *this;
+  }
+  unoptimizable_forward_iterator operator++(int) {
+    auto it = *this;
+    this->operator++();
----------------
philnik777 wrote:

```suggestion
    ++(*this);
```

https://github.com/llvm/llvm-project/pull/213990


More information about the libcxx-commits mailing list