Needing help with parsing

Pages: 12
I'll keep at it, then :). It looks like I need to learn more about what is in the C++ standard library. I don't get much opportunity for those as the basic "hello world" tutorials don't really get into that.

I have come across a problem with the program though. When I add 3 or more matches for a particular character, it stops at two. For example, if I add:

a - b
a - c
a - d

The first two will swap out but not the last one. So if I were to try to parse "aa", the output would be:


I've tried poking through the code the past few days with no luck :(.

Also, I use the m_iCount to set the size of my m_results vector to 1 each time the parsing function is used to get it ready to be used.. I don't use it to store a count of the number of results. I don't see how I could use the size() for this...unless I overlooked something. I didn't hardcode "1" in the function as I've always heard that is bad practice. Should I rename it to something more suitable? Is "m_iCount" misleading?
It's not really a problem; it's a limitation (which was mentioned earlier in this thread)

Note that is only handles the case when you have one or two possible outputs for any given input.

If you need to generalize to work with an arbitrary number of possible output, you need to rework this code to use a loop and modify you DoubleOutput method to do more than just double.

The code which needs to be updated is in the same post (just above the quote which is at the end of the message)

While hardcoded value are bad in general, I would use a literal here


and then recover the current size from the vector when I need it.

Last edited on
Topic archived. No new replies allowed.
Pages: 12