[PATCH] libstdc++: add initializer_list constructor to std::span (P2447)
Giuseppe D'Angelo
giuseppe.dangelo@kdab.com
Tue Dec 3 16:05:03 GMT 2024
Hello,
The attached patch adds the span(initializer_list) constructor, added by
P2447R6 for C++26.
It seems that GCC is somewhat aggressive with its -Winit-list-lifetime
warning, which actively interferes with this feature. The idea of the
new constructor is to allow calls like:
void f(std::span<const int>);
f({1, 2, 3});
which is completely fine as the lifetime of the initializer_list
encompasses the one of the std::span parameter. However GCC complains
about the risk of dangling here. I've therefore disabled the warning for
the new constructor.
Thanks,
--
Giuseppe D'Angelo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-libstdc-add-initializer_list-constructor-to-std-span.patch
Type: text/x-patch
Size: 8962 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20241203/0fc81b17/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4244 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20241203/0fc81b17/attachment.p7s>
More information about the Libstdc++
mailing list