Code:
#include <algorithm>
#include <iostream>
#include <list>
#include <string>
#include <vector>


using namespace std;

template<typename T>
bool do_something(std::vector<T>& vec)
{
    std::cout << "bool do_something(std::vector<T>& vec)" << std::endl;
    typename vector<T>::iterator iter=vec.begin();
   // vec=++vec;
    std::cout << *iter << std::endl;
    return (vec.begin()!=vec.end());
}


int main()
{
    list<string> mylist;
    list<string>::iterator loc;
    string son = "Danny";
    loc = std::find(mylist.begin(),mylist.end(),son);
    if (loc == mylist.end())
    {
        cout << "So of course when you make a list, it's empty and searches with find() will fail.\n";
    }
    int S=25; S=S-25;
    for(;S<=10;S++)int F=S;

    vector< string >buffer={"Artem","Andryju","Petre"};
    vector< string >::iterator iter = buffer.begin();
    for ( ; iter != buffer.end(); iter++ )
    {
        buffer.push_back( *iter );
        if ( ! do_something( buffer ))
            buffer.pop_back();
    }



return 0;
}

Hello, great to you! I spent forty minutes walking slowly in the debugger, and for a long time thoughtfully carefully examined the debugger.
I do not exactly understand why it falls. I did not quite expect such effects. Rather, I thought that it would be shown, and then grow and show something like this:
Artem Andryju Petre then Artem Andryju Petre Artem Andryju Petre and so on.
But not this, rather incomprehensible, three times writes Artem, only Artem, and after that strangely falls!
I do not understand .. How exactly does this happen? Why falls?

Here to you of course I show the code. And yet here I put it right.
This is a project and it has a compiled file that has a crash.

http://images.vfl.ru/ii/1490275087/9...f/16570301.bmp

DropMeFiles – free one-click file sharing service