[libcxx-commits] [libcxx] [libc++] Remove <string> and <vector> includes from <flat_map> (PR #114876)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 4 13:51:20 PST 2024


https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/114876

`<string>` doesn't seem to be required at all and `flat_map` doesn't support `vector<bool>`, so we can include just `vector<T>`. This cuts the include time in half on my system.


>From 8633fcfd5801552e8d9862a561c79bc25fd216a2 Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Mon, 4 Nov 2024 22:49:37 +0100
Subject: [PATCH] [libc++] Remove <string> and <vector> includes from
 <flat_map>

---
 libcxx/include/__flat_map/flat_map.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libcxx/include/__flat_map/flat_map.h b/libcxx/include/__flat_map/flat_map.h
index 5c14c0ac693b08..dbab5425065f46 100644
--- a/libcxx/include/__flat_map/flat_map.h
+++ b/libcxx/include/__flat_map/flat_map.h
@@ -19,6 +19,7 @@
 #include <__algorithm/ranges_stable_sort.h>
 #include <__algorithm/ranges_unique.h>
 #include <__algorithm/ranges_upper_bound.h>
+#include <__algorithm/remove_if.h>
 #include <__compare/synth_three_way.h>
 #include <__concepts/convertible_to.h>
 #include <__concepts/swappable.h>
@@ -52,10 +53,9 @@
 #include <__type_traits/maybe_const.h>
 #include <__utility/exception_guard.h>
 #include <__utility/pair.h>
+#include <__vector/vector.h>
 #include <initializer_list>
 #include <stdexcept>
-#include <string>
-#include <vector>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header



More information about the libcxx-commits mailing list