* include/bits/forward_list.h: Only include required headers.
(forward_list::reference): Define directly, not using __alloc_traits.
(forward_list::const_reference): Likewise.
std::forward_list is only defined in C++11 so it doesn't need to use
__alloc_traits::reference to be compatible with C++03 allocators and
can just define the reference and const_reference typedefs as
specified in C++11.
Replacing <memory> with only the required headers has a big impact on
the size of the preprocessed output of <forward_list>
Before:
$ g++ -std=c++11 -E fl.cc | wc
25934 56245 640581
After:
$ g++ -std=c++11 -E fl.cc | wc
8626 17685 216904
Tested x86_64-linux, committed to trunk.
commit 3755b17cf58acc001a422378602c423398c27b51
Author: Jonathan Wakely <[email protected]>
Date: Sun Apr 7 16:27:18 2013 +0100
* include/bits/forward_list.h: Only include required headers.
(forward_list::reference): Define directly, not using __alloc_traits.
(forward_list::const_reference): Likewise.
diff --git a/libstdc++-v3/include/bits/forward_list.h
b/libstdc++-v3/include/bits/forward_list.h
index 608d678..8270c4e 100644
--- a/libstdc++-v3/include/bits/forward_list.h
+++ b/libstdc++-v3/include/bits/forward_list.h
@@ -32,10 +32,13 @@
#pragma GCC system_header
-#include <memory>
-#if __cplusplus >= 201103L
#include <initializer_list>
-#endif
+#include <bits/stl_iterator_base_types.h>
+#include <bits/stl_iterator.h>
+#include <bits/stl_algobase.h>
+#include <bits/stl_function.h>
+#include <bits/allocator.h>
+#include <ext/alloc_traits.h>
namespace std _GLIBCXX_VISIBILITY(default)
{
@@ -421,8 +424,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
typedef _Tp value_type;
typedef typename _Alloc_traits::pointer pointer;
typedef typename _Alloc_traits::const_pointer const_pointer;
- typedef typename _Alloc_traits::reference reference;
- typedef typename _Alloc_traits::const_reference const_reference;
+ typedef value_type& reference;
+ typedef const value_type&
const_reference;
typedef _Fwd_list_iterator<_Tp> iterator;
typedef _Fwd_list_const_iterator<_Tp> const_iterator;