[PATCH, libstdc++] Uniform container erasure for c++20.

Ed Smith-Rowland 3dw4rd@verizon.net
Thu Nov 29 15:19:00 GMT 2018


On 11/29/18 9:09 AM, Jonathan Wakely wrote:
> On 29/11/18 08:47 -0500, Ed Smith-Rowland wrote:
>> Fixed with 266616.
>
> Thanks!
>
>> Index: include/std/deque
>> ===================================================================
>> --- include/std/deque    (revision 266567)
>> +++ include/std/deque    (working copy)
>> @@ -58,6 +58,7 @@
>> #pragma GCC system_header
>>
>> #include <bits/stl_algobase.h>
>> +#include <bits/stl_algo.h> // For remove and remove_if
>
> Please only include <bits/stl_algo.h> when __cplusplus > 201703L
> otherwise we include hundreds of kilobytes of code just for these tiny
> functions that aren't even defined in the default C++14 dialect.

Done with 266624.

Ed

> At some point I'll split std::remove and std::remove_if into their own
> header, and we can just include that instead


-------------- next part --------------

2018-11-29  Edward Smith-Rowland  <3dw4rd@verizon.net>

	Only include bits/stl_algo.h for C++20.
	* include/std/deque: Only include bits/stl_algo.h for C++20.
	* include/std/string: Ditto.
	* include/std/vector: Ditto.

-------------- next part --------------
Index: include/std/deque
===================================================================
--- include/std/deque	(revision 266616)
+++ include/std/deque	(working copy)
@@ -58,7 +58,9 @@
 #pragma GCC system_header
 
 #include <bits/stl_algobase.h>
-#include <bits/stl_algo.h> // For remove and remove_if
+#if __cplusplus > 201703L
+#  include <bits/stl_algo.h> // For remove and remove_if
+#endif // C++20
 #include <bits/allocator.h>
 #include <bits/stl_construct.h>
 #include <bits/stl_uninitialized.h>
Index: include/std/string
===================================================================
--- include/std/string	(revision 266616)
+++ include/std/string	(working copy)
@@ -48,7 +48,9 @@
 #include <bits/stl_function.h> // For less
 #include <ext/numeric_traits.h>
 #include <bits/stl_algobase.h>
-#include <bits/stl_algo.h> // For remove and remove_if
+#if __cplusplus > 201703L
+#  include <bits/stl_algo.h> // For remove and remove_if
+#endif // C++20
 #include <bits/range_access.h>
 #include <bits/basic_string.h>
 #include <bits/basic_string.tcc>
Index: include/std/vector
===================================================================
--- include/std/vector	(revision 266616)
+++ include/std/vector	(working copy)
@@ -58,7 +58,9 @@
 #pragma GCC system_header
 
 #include <bits/stl_algobase.h>
-#include <bits/stl_algo.h> // For remove and remove_if
+#if __cplusplus > 201703L
+#  include <bits/stl_algo.h> // For remove and remove_if
+#endif // C++20
 #include <bits/allocator.h>
 #include <bits/stl_construct.h>
 #include <bits/stl_uninitialized.h>


More information about the Libstdc++ mailing list