std::string is just an instantiation of std::basic_string with char, char_traits<char> and alloc (in that order). So, you can easily use your own strings with a different allocator, while still using char and char_traits<char> for the first two template arguments.
Robert On Nov 23, 2009, at 3:12 PM, Jon Rafkind wrote: > On 11/23/2009 01:07 PM, Robert Grimm wrote: >> Jon, >> >> if C++ memory management overheads are what really bogs down your parsers, >> you might want to take a page out of Scott McPeak's playbook: >> >> His Elkhound-generated C++ parsers do not free memory nor do they integrate >> GC. Instead, you just allocate from a dedicated region, copy out the AST >> after parsing, and kill the entire region in one operation. >> >> Maybe that might help. Then again I like Rats!-generated parsers to be >> faster :) >> >> > Yes, I thought of that as well. Last time I checked I could not find a way to > override 'new' for a single file/module. Either its globally defined or its > defined for a single class. I could override new for all my AST structures > but I used std::string a few times which I have no control over. But if I got > rid of std::string then it may be possible. _______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg