std::basic_ostringstream appears to be missing allocator-aware constructor

112 views
Skip to first unread message

Nut...@gmx.net

unread,
Jun 2, 2014, 8:53:49 AM6/2/14
to std-dis...@isocpp.org
Hi,

I originally brought this topic up on StackOverflow (link to the topic: http://stackoverflow.com/questions/23955828/how-to-use-basic-ostringstream-with-stateful-custom-allocator-c11) and was told that it might be a good idea to forward the question to this group.

The std::basic_ostringstream template can be instantiated with an allocator template argument, but std::basic_ostringstream does not appear to have a constructor that actually takes an allocator, so using stateful allocators with std::basic_ostringstream is simply not possible. Are the C++ standard wizards aware of this issue yet?

Ville Voutilainen

unread,
Jun 2, 2014, 9:08:27 AM6/2/14
to std-dis...@isocpp.org
I tried to find a relevant library issue, but couldn't. The closest I found is
http://cplusplus.github.io/LWG/lwg-defects.html#251

I think the whole dealing of an allocator is underspecified in
stringbuf and stringstream,
so please follow the instructions at
https://isocpp.org/std/submit-a-library-issue
and submit an issue to the lwgchair.

Andrew Marlow

unread,
Jun 4, 2014, 3:38:08 PM6/4/14
to std-dis...@isocpp.org
I think it's underspecified also. People are working on this but a paper would be most welcome. I recommend contacting John Lakos, Alisdair Meridith or Pablo Halpern. They have done extensive allocator work wrt the std.



--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-discussio...@isocpp.org.
To post to this group, send email to std-dis...@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-discussion/.



--
Regards,

Andrew Marlow
http://www.andrewpetermarlow.co.uk

Daniel Krügler

unread,
Jun 4, 2014, 3:51:46 PM6/4/14
to std-dis...@isocpp.org
2014-06-02 15:08 GMT+02:00 Ville Voutilainen <ville.vo...@gmail.com>:
> On 2 June 2014 15:53, <Nut...@gmx.net> wrote:
>> Hi,
>>
>> I originally brought this topic up on StackOverflow (link to the topic:
>> http://stackoverflow.com/questions/23955828/how-to-use-basic-ostringstream-with-stateful-custom-allocator-c11)
>> and was told that it might be a good idea to forward the question to this
>> group.
>>
>> The std::basic_ostringstream template can be instantiated with an allocator
>> template argument, but std::basic_ostringstream does not appear to have a
>> constructor that actually takes an allocator, so using stateful allocators
>> with std::basic_ostringstream is simply not possible. Are the C++ standard
>> wizards aware of this issue yet?
>
> I tried to find a relevant library issue, but couldn't. The closest I found is
> http://cplusplus.github.io/LWG/lwg-defects.html#251

I'd like to mention that there had been previous (but failed) attempts
during C++11 standardization to realize
better allocator support for string streams, even though they were
responding to NB comments, see e.g.

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3172.pdf

I don't want to discourage anyone (to the contrary), but I'm providing
this link so that any future attempt has a base to work on.

Note that N3172 was an attempt to resolve the NB comment

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3249.html#US140

successfully, but was rejected. But there had been no corresponding
LWG issue, so I certainly agree that submitting such an LWG issue
seems like a good start, especially if someone is interested to
resolve such an issue via a proposal.

- Daniel
Reply all
Reply to author
Forward
0 new messages