3 ms·
std::span is no more a trap than the rest of C++'s standard library in that regard. Are you also eschewing std::vector and std::string? std::string_view, std::a
by vitus 2y ago
std::span is no more a trap than the rest of C++'s standard library in that regard. Are you also eschewing std::vector and std::string? std::string_view, std::array?
I suppose C++26 brings std::span::at, although exceptions are a different can of worms.
- pjmlp 2y agoSome errors are too late to fix, span was originally bounds checked when proposed. Pre-C++98 compiler frameworks used bounds checking by default. And yes, if I am calling the shots, bounds checking are enabled in release builds. Never has been a problem other than performance cargo cult folks. Thankfully governments are making this less of discussion.
- vitus 2y ago> And yes, if I am calling the shots, bounds checking are enabled in release builds. No disagreement there. But I'd prefer to turn it on across the board via compiler flag rather than pull in a special library for it and remember to use that library consistently. And if that's the case, I don't see std::span as any more problematic on this front than the rest of the standard library. (Yes, I know, GSL isn't really a special library on Windows. But anywhere else, it is.)