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

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


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

<details>
<summary>Changes</summary>

`<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.


---
Full diff: https://github.com/llvm/llvm-project/pull/114876.diff


1 Files Affected:

- (modified) libcxx/include/__flat_map/flat_map.h (+2-2) 


``````````diff
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

``````````

</details>


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


More information about the libcxx-commits mailing list