Namespaces
Variants
Views
Actions

Talk:cpp/io/basic stringbuf

From cppreference.com
< Talk:cpp‎ | io

get_allocator (C++20) obtains a copy of the allocator associated with the internal basic_string (public member function)

So I am looking at the standard text and it very clearly states that that "basic_string member" is exposition only. The definition of the class talks about an associated sequence (lowercase) of characters that can be initialized from, or made available as a basic_string. I think that wording clearly shows the intent that `basic_stringbuf` was created with a definition and an interface that allows implementations to choose their internal representation as they feel appropriate.

I understand that `view` that has been added in C++20 has also gone against the design principles of this class template but I still think that it would be a good idea to fix the words for get_allocator to not state something that (at least as of now) is not a standard requirement. Something along the lines of obtaining a copy of the allocator used to allocate and release memory for the internal buffer (or buffers?, my understanding is that there could even be 3). A note can state that most implementations use a single basic_string buffer?

I have once tried to edit this Wiki but the learning curve was scary, and right now at 30 hours working straight, so I kindly ask someone familiar and trusted to make the update.

References: https://eel.is/c++draft/stringbuf#general-1 https://eel.is/c++draft/stringbuf#general-2 (exposition only)

Thanks, Attila 199.172.169.26 17:28, 10 February 2022 (PST)

I was about to disagree on the grounds of it being a programmer's reference rather than ISO appendage, but to my surprise, MS STL doesn't maintain an internal basic_string (the other two do: LLVM libcxx, GNU libstdc++). So yes, you have a real point. --Cubbi (talk) 19:38, 10 February 2022 (PST)