Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++] Remove <string> and <vector> includes from <flat_map> #114876

Merged
merged 1 commit into from
Nov 5, 2024

Conversation

philnik777
Copy link
Contributor

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

@philnik777 philnik777 requested a review from a team as a code owner November 4, 2024 21:51
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Nov 4, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 4, 2024

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

&lt;string&gt; doesn't seem to be required at all and flat_map doesn't support vector&lt;bool&gt;, so we can include just vector&lt;T&gt;. 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 --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

@philnik777 philnik777 force-pushed the flat_map_remove_includes branch 2 times, most recently from 4cdd5b3 to ecb1593 Compare November 5, 2024 13:05
@philnik777 philnik777 force-pushed the flat_map_remove_includes branch from ecb1593 to d6a7b1b Compare November 5, 2024 13:25
@philnik777 philnik777 merged commit 332fda8 into llvm:main Nov 5, 2024
62 checks passed
@philnik777 philnik777 deleted the flat_map_remove_includes branch November 5, 2024 23:14
rampitec pushed a commit that referenced this pull request Nov 5, 2024
`<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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants