This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[v3] Do not use __alloc_traits for forward_list::reference


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

Attachment: patch.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]