[PATCH] Add noexcept-specifier to std::apply and std::make_from_tuple

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[PATCH] Add noexcept-specifier to std::apply and std::make_from_tuple

Jonathan Wakely-3
When unpacking a std::tuple we know that the std::get calls are
noexcept, so only the invocation (for std::apply) and construction (for
std::make_from_tuple) can throw.

We also know the std::get calls won't throw for a std::array, but this
patch doesn't specialize the variable template for std::array. For an
arbitrary tuple-like type we don't know if the std::get calls will
throw, and so just use a potentially-throwing noexcept-specifier.

        * include/std/tuple (__unpack_std_tuple): New variable template and
        partial specializations.
        (apply, make_from_tuple): Add noexcept-specifier.
        * testsuite/20_util/tuple/apply/2.cc: New test.
        * testsuite/20_util/tuple/make_from_tuple/2.cc: New test.

Tested x86_64-linux, committed to trunk.

patch.txt (8K) Download Attachment