|
From: | Hans Aberg |
Subject: | Re: FYI: lalr1.cc: Remove the traits |
Date: | Mon, 19 Sep 2005 11:41:39 +0200 |
On 19 Sep 2005, at 11:25, Akim Demaille wrote:
Also, just use the std::deque for stack. I think that std::stack will not be able to look deeper than top, as is required by the parser.Of course it can't.
Why is this of course?
That's why we used a dequeue from the start.
std::stack uses std::deque for implementation.
And std::deque is in the latest C++ revision written so that it does not invoke copy constructors when expanding the stack, as it just allocates a new chunk, leaving the old one intact.Exactly. Still, time permitting, using vector would be better.
I guess you will have to do some time profiling to figure this out. A typical compilers spends little time in the parsing anyway, so it probably does not matter, from the time point of view. One can also note that if one is using a deque is the C parser, it should work compiled as C++ also for semantic types with copy constructors. The compile C as C++ option is dead, though, I think, in view of past attempts. But I think, for example, LilyPond is using it.
Hans Aberg
[Prev in Thread] | Current Thread | [Next in Thread] |