Thanks everyone. I've decided against using at() because it's a passive parser. It shouldn't throw an exception if it doesn't equal something, it should only move on to the next combination of chunks and compare to those. And I believe using at() in such a manner would defeat the purpose, and (at least) overcomplicate things.
Instead, I've just written a member function
"compare(vector<string>& vsChunks, string sCompare, int nChunk)"
which does
And this seems to work just fine. Thanks again for your suggestions!Code:if(vsChunks.size() >= nChunk + 1) { //Go ahead and compare } else return false; //nChunk doesn't exist, comparing would cause a segfault
EDIT:
I'm using "new" because I want to be able to explicitly delete that object. The parser grows exponentially from that point, and I don't want to chance an overflow; so I'm dynamically allocating as much as I can without overcomplicating.Originally Posted by Elysia