[PATCH] libstdc++: add initializer_list constructor to std::span (P2447)

Giuseppe D'Angelo giuseppe.dangelo@kdab.com
Wed Dec 11 21:18:24 GMT 2024


On 11/12/2024 21:41, Jonathan Wakely wrote:
> Hmm, the warning is useful if somebody does:
> 
> std::span s({1,2,3});
> 
> So I think we do want the warning, but maybe give it a special case so
> it doesn't warn for an rvalue std::span.

Do you have anything in mind to make this work?

Note that the above is akin to:

std::vector<int> getVector();
std::span<const int> sp = getVector();


which is also similar to:

std::string getString();
std::string_view sv = getString();


and none of these warn at the moment.

Thank you,
-- 
Giuseppe D'Angelo
-------------- 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/20241211/63e18242/attachment.p7s>


More information about the Libstdc++ mailing list