[libcxx-commits] [libcxx] [libc++] Guard container benchmarks on library availability (PR #215408)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Tue Aug 11 03:38:36 PDT 2026


================
@@ -398,26 +399,26 @@ void sequence_container_benchmarks(std::string container) {
         }
       });
 
-#if TEST_STD_VER >= 23
-    for (auto gen : generators)
-      bench("append_range() (into empty container)" + tostr(gen), [gen](auto& state) {
-        auto const size = state.range(0);
-        std::vector<ValueType> in;
-        std::generate_n(std::back_inserter(in), size, gen);
-        DoNotOptimizeData(in);
+    if constexpr (has_append_range) {
----------------
ldionne wrote:

We can do that, but we'd  throw away some information:
- `vector::append_range` landed on 2023-05-08
- `deque::append_range` landed on 2023-05-17
- `list::append_range` landed on 2023-07-10
- `__cpp_lib_containers_ranges` was only defined in `<version>` on 2024-05-04

This means that between May 2023 and May 2024, `append_range` was defined (for e.g. `list` and `vector`) but we hadn't defined the FTM yet. We could benchmark that method but only if we use the `requires` clause.

I'm not super strongly attached, but that was the reasoning. WDYT?

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


More information about the libcxx-commits mailing list