
śr., 24 wrz 2025 o 21:26 Emil Dotchevski via Boost <boost@lists.boost.org> napisał(a):
Can a zero-terminated string view return the size?
The "zero-terminated string view", much like std::string_view, holds a pointer and a size, so it can return the size in constant time. (It also has to maintain an invariant that the null-terminator mark is consistent with the separately stored size.) Regards, &rzej;
On Wed, Sep 24, 2025 at 3:22 PM Andrzej Krzemienski via Boost < boost@lists.boost.org> wrote:
Hi Everyone, Would Boost libraries benefit from having a string_view-like type with the guarantee that the underlying character sequence is null-terminated?
This could be as yet another Boost library, or as part of Boost.Core. Maybe Boost already has such a type somewhere?
The need for such a type surfaces time and again. When a library needs to be passed both const char * and std::string cheaply, only to pass it down to low-level C-libraries later. We have seen one recently during the review of Boost.Sqlite. One is again proposed for standardization: wg21.link/p3655.
Regards, &rzej; _______________________________________________ Boost mailing list -- boost@lists.boost.org To unsubscribe send an email to boost-leave@lists.boost.org https://lists.boost.org/mailman3/lists/boost.lists.boost.org/ Archived at:
https://lists.boost.org/archives/list/boost@lists.boost.org/message/E3D7ZHSI...
_______________________________________________ Boost mailing list -- boost@lists.boost.org To unsubscribe send an email to boost-leave@lists.boost.org https://lists.boost.org/mailman3/lists/boost.lists.boost.org/ Archived at: https://lists.boost.org/archives/list/boost@lists.boost.org/message/E6Q6K2QR...