Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • 1
    This solution allocates strings inside a custom stack data structure, not on a true stack that compiler uses to remember return address. It still may work as a solution. I upvote. Commented Oct 14, 2014 at 9:23
  • 1
    This code is in C++14. The requirement was C++03...still, the principle holds, it can be re-written. Note that std::basic_string uses the allocator in weird and wonderful ways, so you will have to add things like comparison operators. Also note that std::basic_string (and other containers) use copy constructor of the allocator liberally, and the stack_store does not handle that gracefully. Commented Oct 14, 2014 at 11:36
  • @arunasr It is c++11 code. At least this is what I compile it with. Commented Oct 14, 2014 at 13:07
  • @user1095108 The point is, it is not C++03/C++98. And it will not compile if used with basic_string because it does not implement operator== and struct rebind. I am not sure how it will handle copy operation, but by the look of it, it is not going to be pretty. Commented Oct 14, 2014 at 13:21