Can you help with this? I am having loop where I am parsing argument. My problem is that I don't know how to access the characters under (*it).
So I need to replace (*it)[n] for valid syntax used in C++03.
For example the (*it) refers to word "bla{y:12-15}blabla{x:124-}blabla"
other variations are "{y:12-15}blabla{x:124-}blabla" or "bla{y:12-15}blabla{x:124-}" or "{y:12-15}blabla{x:124-}"
so if it would be char * arg; I would refer it like arg[n] but I cannot do it with iterator. So I am curious how to do it correctly.
it++; i++; // read next argument
std::istringstream regex((*it));
int prefixn=0; // position of prefix
int sufixn=sizeof((*it)); // position of suffix
char * first; char * second;
for (int n=0; n<sizeof((*it)); n++){
if( (*it)[n] == '{')
{
if (!prefixn) // set the first position
{
prefixn=n;
for (; (*it)[n] <> '}'; n++)
first+=(*it)[n];
}
else
{
for (; (*it)[n] <> '}'; n++)
second+=(*it)[n];
}
}
if( (*it)[n] == '}')
{
sufixn=n; // set the last position
}
}
Is there way how to watch the value of (*it)[n] in Visual Studio during watch?
I can add (*it)[n] to Watch pan but it will display: Error: Overloaded operator not found
I am using this loop: for (std::vector<std::string>::iterator it = raw_args.begin(); it != raw_args.end(); ++it)
I want to get characters one by one from the vector.
Now I have this problem:
When prefix is char * = "";
and (*it) is some word, eg. "one"
and n is 0,
I need prefix to be set to "o". How to do it?
This:
prefix=prefix + (*it)[n];
sets prefix to "0"