From: Guido on
Thanks to all.

I see the problem it's on some merge algorithm bugs that I had solved,
and like Lailoken had said, the invalidate of the iterator. Now it
work, thanks for the suggestions.

Guido

On 24 Apr, 19:57, "Daniel T." <danie...(a)earthlink.net> wrote:
> Guido <f8ki...(a)gmail.com> wrote:
>
> First let's get your merge fixed. It would be far easier if you didn't
> do an in-place merge. For example an interface like this:
>
> vector<string> merge(const vector<string>& left, const vector<string>&
> right);
>
> Yes, the above isn't as efficient, but it is a better learning exorcise.
> Please consider it.
>
> If you insist on doing an in-place merge, then start with a simple case:
>
> int main() {
> vector<string> v;
> v.push_back("1");
> v.push_back("2");
> merge(v, 0, 1, 2);
> printVector(v);
>
> }
>
> Write the simplest solution you can think of. Then go to the next case:
>
> int main() {
> vector<string> v;
> v.push_back("1");
> v.push_back("2");
> merge(v, 0, 1, 2);
> printVector(v);
>
> v.clear();
> v.push_back("2");
> v.push_back("1");
> merge(v, 0, 1, 2);
> printVector(v);
>
> }
>
> Post your results and we can go from there.
>
> --
> [ Seehttp://www.gotw.ca/resources/clcm.htmfor info about ]
> [ comp.lang.c++.moderated. First time posters: Do this! ]



--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]