Apparently this got spam-filtered and didn't make it to the lists...
On 13/10/16 18:34 +0100, Jonathan Wakely wrote:
This splits the large (2200 lines) <functional> header into smaller
pieces, so there are separate headers for:
- std::less, std::equal_to etc. (already in their own header)
- std::__invoke (already in its own header)
- std::reference_wrapper (often used on its own, e.g. in <tuple>)
- std::function (using in <future> and <regex>)
Everything else (std::mem_fn, std::bind, std::not_fn, searchers) stays
in <functional>, because we don't actually need them elsewhere in the
Code which doesn't need the whole of <functional> should include the
relevant <bits/*> header instead.
This means that we don't need to pull the whole of <functional> (and
<vector> and <unordered_map>) into <memory> just because shared_ptr
wants to use reference_wrapper in one place. This reduces <memory>
from 48kloc to 30kloc!
The patch is compressed because it's quite large, but it's mostly just
moving big blocks of code from <functional> into new headers.
* include/Makefile.am: Add <bits/refwrap.h> and <bits/std_function.h>.
* include/Makefile.in: Regenerate.
* include/bits/refwrap.h: New header.
(reference_wrapper, ref, cref): Move here from <functional>.
* include/bits/shared_ptr_base.h: Include <bits/refwrap.h> and
<bits/stl_function.h> instead of <functional>.
* include/bits/std_function.h: New header.
(__is_location_invariant, _Nocopy_types, _Any_data)
(_Simple_type_wrapper, _Function_base, _Function_handler, function):
Move here from <functional>.
* include/bits/unique_ptr.h: Include <bits/stl_function.h>.
* include/std/functional: Include new headers and move components to
* include/std/future: Include <bits/std_function.h>.
* include/std/memory: Don't include <functional>.
* testsuite/20_util/default_delete/48631_neg.cc: Adjust dg-error line.
* testsuite/20_util/default_delete/void_neg.cc: Likewise.
* testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise.
1.cc: Include <vector>.
* testsuite/20_util/unique_ptr/assign/48635_neg.cc: Adjust dg-error
* testsuite/20_util/unique_ptr/assign/cv_qual.cc: Likewise.
* testsuite/20_util/unique_ptr/cons/cv_qual.cc: Likewise.
* testsuite/20_util/unique_ptr/modifiers/cv_qual.cc: Likewise.
* testsuite/30_threads/thread/native_handle/cancel.cc: Include