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.

Any objections?

        * include/ Add <bits/refwrap.h> and <bits/std_function.h>.
        Order alphabetically.
        * include/ Regenerate.
        * include/bits/refwrap.h: New header.
        (_Maybe_get_result_type,_Weak_result_type_impl, _Weak_result_type)
        (_Reference_wrapper_base_impl, _Reference_wrapper_base)
        (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.
        (_Maybe_unary_or_binary_function, bad_function_call)
        (__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/ Adjust dg-error line.
        * testsuite/20_util/default_delete/ Likewise.
        * testsuite/20_util/shared_ptr/thread/
        Include <functional>.
        * testsuite/20_util/shared_ptr/thread/ Likewise.
        * testsuite/20_util/specialized_algorithms/memory_management_tools/ Include <vector>.
        * testsuite/20_util/unique_ptr/assign/ Adjust dg-error
        * testsuite/20_util/unique_ptr/assign/ Likewise.
        * testsuite/20_util/unique_ptr/cons/ Likewise.
        * testsuite/20_util/unique_ptr/modifiers/ Likewise.
        * testsuite/30_threads/thread/native_handle/ Include

Reply via email to