[libcxx-commits] [libcxx] [libc++] Introduce `__product_iterator_traits` and optimise `flat_map::insert` (PR #139454)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jun 6 10:38:46 PDT 2025


================
@@ -0,0 +1,72 @@
+//===----------------------------------------------------------------------===//
+//
+// 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 _LIBCPP___ITERATOR_PRODUCT_ITERATOR_H
+#define _LIBCPP___ITERATOR_PRODUCT_ITERATOR_H
+
+// Product iterators are iterators that contain two or more underlying iterators.
+//
+// For example, std::flat_map stores its data into two separate containers, and its iterator
+// is a proxy over two separate underlying iterators. The concept of product iterators
+// allows algorithms to operate over these underlying iterators separately, opening the
+// door to various optimizations.
+//
+// If __product_iterator_traits can be instantiated, the following functions and associated types must be provided:
----------------
ldionne wrote:

Missing documentation for `__make_product_iterator`!

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


More information about the libcxx-commits mailing list