Some of the modifiers to forward_list are special to that container and accordingly are not described in [container.requirements] ff. Specifically, insert_after (iterator overload), insert_range_after and emplace_after do not verify that the value_type is Cpp17EmplaceConstructible from the appropriate argument(s). Instead, emplace_after specifies that the inserted object is constructed as if by value_type(std::forward<Args>(args)...), but this
has a wider meaning (a C-style cast) if
sizeof...(Args) == 1:
std::forward_list<int*> l;
l.emplace_after(l.before_begin(), 99);
libstdc++, libc++ and MS-STL reject this already
(they use std::construct_at), so adding a
precondition should be editorial.
To P12, prepend: T is
Cpp17EmplaceConstructible into this from first.
To P15, prepend: T is
Cpp17EmplaceConstructible into this from
ranges::begin(rg).
To P20, prepend: T is
Cpp17EmplaceConstructible into *this from args.
To P21, replace value_type(std::forward<Args>(args)...) with std::forward<Args>(args)...
(cf. sequence.reqmts/22)
Some of the modifiers to forward_list are special to that container and accordingly are not described in [container.requirements] ff. Specifically, insert_after (iterator overload), insert_range_after and emplace_after do not verify that the value_type is Cpp17EmplaceConstructible from the appropriate argument(s). Instead, emplace_after specifies that the inserted object is constructed as if by
value_type(std::forward<Args>(args)...)
, but this has a wider meaning (a C-style cast) if sizeof...(Args) == 1:std::forward_list<int*> l;
l.emplace_after(l.before_begin(), 99);
libstdc++, libc++ and MS-STL reject this already (they use std::construct_at), so adding a precondition should be editorial.To P12, prepend: T is Cpp17EmplaceConstructible into this from first. To P15, prepend: T is Cpp17EmplaceConstructible into this from ranges::begin(rg). To P20, prepend: T is Cpp17EmplaceConstructible into *this from args. To P21, replace
value_type(std::forward<Args>(args)...)
withstd::forward<Args>(args)...
(cf. sequence.reqmts/22)