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

Side by Side Diff: third_party/WebKit/public/platform/WebVector.h

Issue 2799553002: Provide a std::vector compliant empty() method for WebVector. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « third_party/WebKit/public/platform/WebMediaConstraints.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void assign(const C& other) { 104 void assign(const C& other) {
105 m_data.assign(other.begin(), other.end()); 105 m_data.assign(other.begin(), other.end());
106 } 106 }
107 107
108 template <typename U> 108 template <typename U>
109 void assign(const U* values, size_t size) { 109 void assign(const U* values, size_t size) {
110 m_data.assign(values, values + size); 110 m_data.assign(values, values + size);
111 } 111 }
112 112
113 size_t size() const { return m_data.size(); } 113 size_t size() const { return m_data.size(); }
114 bool isEmpty() const { return m_data.empty(); } 114 bool empty() const { return m_data.empty(); }
115 // TODO(slangley): Remove all uses of isEmpty.
116 bool isEmpty() const { return empty(); }
115 117
116 T& operator[](size_t i) { 118 T& operator[](size_t i) {
117 DCHECK_LT(i, m_data.size()); 119 DCHECK_LT(i, m_data.size());
118 return m_data[i]; 120 return m_data[i];
119 } 121 }
120 122
121 const T& operator[](size_t i) const { 123 const T& operator[](size_t i) const {
122 DCHECK_LT(i, m_data.size()); 124 DCHECK_LT(i, m_data.size());
123 return m_data[i]; 125 return m_data[i];
124 } 126 }
125 127
126 T* data() { return m_data.data(); } 128 T* data() { return m_data.data(); }
127 const T* data() const { return m_data.data(); } 129 const T* data() const { return m_data.data(); }
128 130
129 iterator begin() { return m_data.begin(); } 131 iterator begin() { return m_data.begin(); }
130 iterator end() { return m_data.end(); } 132 iterator end() { return m_data.end(); }
131 const_iterator begin() const { return m_data.begin(); } 133 const_iterator begin() const { return m_data.begin(); }
132 const_iterator end() const { return m_data.end(); } 134 const_iterator end() const { return m_data.end(); }
133 135
134 void swap(WebVector<T>& other) { m_data.swap(other.m_data); } 136 void swap(WebVector<T>& other) { m_data.swap(other.m_data); }
135 137
136 private: 138 private:
137 std::vector<T> m_data; 139 std::vector<T> m_data;
138 }; 140 };
139 141
140 } // namespace blink 142 } // namespace blink
141 143
142 #endif 144 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/public/platform/WebMediaConstraints.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698