We can't see how vettore is constructed and passed.
I can't even be certain the fault happens where you think it does. Is a debugger telling you that's the line?
If vettore is valid, that line shouldn't fail. That's why we must see the calling code.
My suspicion, however, is that the fault is actually happening on the next line, dereferencing _tmp, which would be expected if vettore is actually empty.
You have invalid pointer.
You try to call the member function of a foo object, but your pointer does not point to a valid foo object.
If the pointer would point to a valid object, the statement makes it to point to somewhere else. What does the crea_circuito return? Who will remember the first foo?
I ran it, got no segmentation fault. It ran just fine. You should also replace line 8 in "foo.h" with: vector<string>::const_iterator _tmp; If you don't plan on changing the values within the string, then best to use a pointer to const