Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: src/list.h

Issue 40105: Add an insert function to our list utility class. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/list-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 // Adds a copy of the given 'element' to the end of the list, 73 // Adds a copy of the given 'element' to the end of the list,
74 // expanding the list if necessary. 74 // expanding the list if necessary.
75 T& Add(const T& element); 75 T& Add(const T& element);
76 76
77 // Added 'count' elements with the value 'value' and returns a 77 // Added 'count' elements with the value 'value' and returns a
78 // vector that allows access to the elements. The vector is valid 78 // vector that allows access to the elements. The vector is valid
79 // until the next change is made to this list. 79 // until the next change is made to this list.
80 Vector<T> AddBlock(const T& value, int count); 80 Vector<T> AddBlock(const T& value, int count);
81 81
82 // Inserts a copy of the given element at index i in the list. All
83 // elements formerly at or above i are moved up and the length of
84 // the list increases by one.
85 T& Insert(int i, const T& element);
86
82 // Removes the i'th element without deleting it even if T is a 87 // Removes the i'th element without deleting it even if T is a
83 // pointer type; moves all elements above i "down". Returns the 88 // pointer type; moves all elements above i "down". Returns the
84 // removed element. 89 // removed element.
85 T Remove(int i); 90 T Remove(int i);
86 91
87 // Removes the last element without deleting it even if T is a 92 // Removes the last element without deleting it even if T is a
88 // pointer type. Returns the removed element. 93 // pointer type. Returns the removed element.
89 INLINE(T RemoveLast()) { return Remove(length_ - 1); } 94 INLINE(T RemoveLast()) { return Remove(length_ - 1); }
90 95
91 // Clears the list by setting the length to zero. Even if T is a 96 // Clears the list by setting the length to zero. Even if T is a
(...skipping 22 matching lines...) Expand all
114 INLINE(T* NewData(int n)) { return static_cast<T*>(P::New(n * sizeof(T))); } 119 INLINE(T* NewData(int n)) { return static_cast<T*>(P::New(n * sizeof(T))); }
115 INLINE(void DeleteData(T* data)) { P::Delete(data); } 120 INLINE(void DeleteData(T* data)) { P::Delete(data); }
116 121
117 DISALLOW_COPY_AND_ASSIGN(List); 122 DISALLOW_COPY_AND_ASSIGN(List);
118 }; 123 };
119 124
120 125
121 } } // namespace v8::internal 126 } } // namespace v8::internal
122 127
123 #endif // V8_LIST_H_ 128 #endif // V8_LIST_H_
OLDNEW
« no previous file with comments | « no previous file | src/list-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698