[libcxx-commits] [libcxx] [libc++] Add benchmark for `std::exception_ptr` (PR #164278)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Oct 21 01:28:45 PDT 2025


================
@@ -18,4 +18,49 @@ void bm_make_exception_ptr(benchmark::State& state) {
 }
 BENCHMARK(bm_make_exception_ptr)->ThreadRange(1, 8);
 
+static bool exception_ptr_moves_copies_swap(std::exception_ptr p1) {
+  // Taken from https://github.com/llvm/llvm-project/issues/44892
+  std::exception_ptr p2(p1);            // Copy constructor
+  std::exception_ptr p3(std::move(p2)); // Move constructor
+  p2 = std::move(p1);                   // Move assignment
+  p1 = p2;                              // Copy assignment
+  swap(p1, p2);                         // Swap
----------------
philnik777 wrote:

These comments seem rather obvious.

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


More information about the libcxx-commits mailing list