]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Simplify std::forward_list assignment using 'if constexpr'
authorJonathan Wakely <jwakely@redhat.com>
Mon, 25 Nov 2024 21:57:57 +0000 (21:57 +0000)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 27 Nov 2024 12:30:01 +0000 (12:30 +0000)
commit751f91be72d8b73a9dc71456f475268397330100
tree4f0590e6b5dca821314aa1bad97cd468a273dcc5
parent281ac0ef1001aac1b4f4223c5dbba725a5cffb43
libstdc++: Simplify std::forward_list assignment using 'if constexpr'

Use diagnostic pragmas to allow using `if constexpr` in C++11 mode, so
that we don't need to use tag dispatching.

The unused member functions are preserved for the purposes of explicit
instantiations. The _M_assign function template can be removed, because
member function templates aren't instantiated by explicit instantiations
anyway.

libstdc++-v3/ChangeLog:

* include/bits/forward_list.h (operator=(forward_list&&)): Use
if constexpr instead of dispatching to _M_move_assign.
(assign(InputIterator, InputIterator)): Use if constexpr instead
of dispatching to _M_assign.
(assign(size_type, const T&)): Use if constexpr instead of
dispatching to _M_assign_n.
(_M_move_assign, _M_assign_n): Do not define for versioned
namespace.
(_M_assign): Remove.
libstdc++-v3/include/bits/forward_list.h