Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. template <class data_type>
  2. void sequence<data_type>::attach(data_type value){
  3. if(used == capacity){
  4. resize(used+1);
  5. }
  6. if(current_index >= used){
  7. start();
  8. advance();
  9. advance();
  10. }
  11. if(used!=0){
  12. for(int i = used; i > current_index+1; i--){
  13. data[i] = data[i-1];
  14. }
  15. data[current_index+1] = value;
  16. current_index++;
  17. }
  18. data[current_index] = value;
  19. ++used;
  20.  
  21. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement