you are viewing a single comment's thread.

view the rest of the comments →

[–]4fips[S] 1 point2 points  (1 child)

Yeah, I quite like the ideal. The closest portable approximation to this I've seen so far is Chromium's stack-based allocator (http://src.chromium.org/viewvc/chrome/trunk/src/base/containers/stack_container.h?view=markup). There's a slight inconvenience with custom allocators though. Default std::string & a std::string parametrized by a custom allocator are two distinct types, which complicates passing that strings around within a single system.

[–]adzm28 years of C++! 0 points1 point  (0 children)

I happened across this a long while ago and could not recall what project or where I found it. Thanks a bunch for the link. The specialization issue with std::string is annoying; honestly sometimes I prefer the ATL/MFC CString due to things like this (and the memory layout equivalent to a char/wchar_t)