On 2009-05-24 14:13:31 -0400, Michel Fortin <[email protected]> said:
The reason is that if your callback api only does a single callback, all
you've really done is move the switch statement inside the function call
at the cost of having to define a crapload of functions outside of it.
The thing is that inside the parser code there is already a separate
code path for dealing with each type of token. Various callbacks can be
called from these separate code paths. When you return after parsing
one token, the code path isn't different anymore, so you need to add an
extra swich statement that wouldn't be there with a callback called
from the right code path.
I suddenly noticed that I misunderstood what you meant in the paragraph
above so I don't expect my answer above to fit your question.
Nevertheless, I suppose the examples at the end of my previous post
will clarify things: basically the callback isn't a function pointer,
it's an alias template argument which can disptach to overloaded
functions or template functions so you don't need a switch statement.
Sorry for any confusion.
--
Michel Fortin
[email protected]
http://michelf.com/