Hi Nate,

On Thu, Aug 4, 2011 at 12:55 AM, Nathan Ridge <zeratul976@hotmail.com> wrote:
Why do the tokenizer and the iterator need to be in the base class at all?
 Why not just construct them on the stack in the derived constructor?

Basically, the derived class instances have very short life - all objects are created on stack. And, all the derived class need to parse tokens and have to create a Tokenizer, character separator, etc., anyway. Putting Boost.Tokenizer and character separator in Base class free me (and others) from having to create Tokenizer in the derived classes (there are too many) and I can just repeatedly use the nextToken() that I have defined in the base class to get all the tokens. Anyway, my problem is solved now - iterators become invalid after execution of the derived class constructors. Basically, I don't want anyone to write monolithic functions that do everything in the world. So, I don't want them to mix business domain logic with parsing code and vice versa and, in handling callbacks, I don't want them to parse. Just a small measure for maintainability. Since Boost.Tokenizer and character_separator will be created anyway and since derived classes have very short life and all derived classes' objects get created on stack, I think there is no harm in putting the Tokenizer & character separator in the base class - I am not separately storing the string-to-be-passed in the base class though as that apparently gets stored by the Tokenizer itself.

Thanks & regards, Asif