Segment Fault means you have tried to access memory beyond the boundary of segment, maybe code or data segment.
The error is :
vector iterators incompatible
Why?
Because you have copied an Array from A to B, but you want to use A.begin() iterator to compare with B's iterator, and this will not pass compiler's compatibility check, in Visual Studio,
void _Compat(const _Myiter& _Right) const
{ // test for compatible iterator pair
if (this->_Getcont() == 0
|| this->_Getcont() != _Right._Getcont())
{ // report error
_DEBUG_ERROR("vector iterators incompatible");
_SCL_SECURE_INVALID_ARGUMENT;
}
}
So my advice is ,do not try to save the iterator that points to the vector begin, you can use a temporary iterator when need
And further advice, learn C++ systematically, do not write codes as you think unless you have enough confidence.
Come on, work hard, you can make it!