I am trying to store all the sorted value to a vector and then pop to A[], I kept got runtime error. Hope someone could give me a hint what i am missing. Thanks a lot.

I actually run my program and putting the test data. There is no problem http://postimg.org/image/3pv7drr0x/,

and this http://postimg.org/image/3rjnms9wn/

```
class Solution {
public:
void merge(int A[], int m, int B[], int n){
//m is total, (m-n) is the actual number in A[]
vector<int> a;
int left;//what's left
int total=m;
m=m-n;//now m is A[]'s real contain value
while(m!=0 && n!=0)
{
if(A[m-1]>B[n-1])
{a.push_back(A[m-1]);
m--;}
else
{a.push_back(B[n-1]);
n--;}
}
left=m+n;
//----------------this is for push back the left to vector
if(m==0)
{
while(left!=0)
{
a.push_back(B[left-1]);
left--;
}
}
else if(n==0)
{
while(left!=0)
{
a.push_back(A[left-1]);
left--;
}
}
//----------------this is for push back the left to vector
for(int i=0;i<total;i++)
{
A[i]=a.back();
a.pop_back();
}
}
};
```