[libcxx-commits] [libcxx] [libc++] Move out `flat_map::iterator` (for reusing it in flat_multimap) (PR #117445)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Mon Dec 9 06:22:07 PST 2024
================
@@ -0,0 +1,171 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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___FLAT_MAP_KEY_VALUE_ITERATOR_H
+#define _LIBCPP___FLAT_MAP_KEY_VALUE_ITERATOR_H
+
+#include <__compare/three_way_comparable.h>
+#include <__concepts/convertible_to.h>
+#include <__config>
+#include <__iterator/iterator_traits.h>
+#include <__memory/addressof.h>
+#include <__ranges/access.h>
+#include <__type_traits/conditional.h>
+#include <__type_traits/maybe_const.h>
+#include <__utility/move.h>
+#include <__utility/pair.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+# pragma GCC system_header
+#endif
+
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Owner, class _KeyContainer, class _MappedContainer, bool _Const>
----------------
ldionne wrote:
In https://devblogs.microsoft.com/cppblog/what-are-scary-iterators/, they make a point that e.g. different allocators should probably not result in different iterators. That makes some sense to me, although I guess it depends what the pointer type is. But here it seems like the amount of stuff we need to cary around in `__key_value_iterator` is probably not worth it.
https://github.com/llvm/llvm-project/pull/117445
More information about the libcxx-commits
mailing list