Attach function

I am having trouble passing in variables in a function. I am passing in 10,20, then 30 into the attach. then run the start and attach 15 after the 10, and my program then would crash, when i try to insert into the middle of the class array.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void sequence::start()
	{
		current_index=0;
	}
void sequence::attach(const value_type& entry)
	{	
		assert(size()<CAPACITY); 
		size_type i;
		if (!is_item()) {
          current_index = used - 1;  
     }

     for (i = used; i > current_index + 1; i++) {
         data[i] = data[i-1];
     } 
     data[current_index+1] = entry; 
     ++current_index; 
     ++used; 
	}
Topic archived. No new replies allowed.