OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_CONTAINERS_STACK_CONTAINER_H_ | 5 #ifndef BASE_CONTAINERS_STACK_CONTAINER_H_ |
6 #define BASE_CONTAINERS_STACK_CONTAINER_H_ | 6 #define BASE_CONTAINERS_STACK_CONTAINER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 const typename Allocator::Source& stack_data() const { | 169 const typename Allocator::Source& stack_data() const { |
170 return stack_data_; | 170 return stack_data_; |
171 } | 171 } |
172 #endif | 172 #endif |
173 | 173 |
174 protected: | 174 protected: |
175 typename Allocator::Source stack_data_; | 175 typename Allocator::Source stack_data_; |
176 Allocator allocator_; | 176 Allocator allocator_; |
177 ContainerType container_; | 177 ContainerType container_; |
178 | 178 |
| 179 private: |
179 DISALLOW_COPY_AND_ASSIGN(StackContainer); | 180 DISALLOW_COPY_AND_ASSIGN(StackContainer); |
180 }; | 181 }; |
181 | 182 |
182 // StackString ----------------------------------------------------------------- | 183 // StackString ----------------------------------------------------------------- |
183 | 184 |
184 template<size_t stack_capacity> | 185 template<size_t stack_capacity> |
185 class StackString : public StackContainer< | 186 class StackString : public StackContainer< |
186 std::basic_string<char, | 187 std::basic_string<char, |
187 std::char_traits<char>, | 188 std::char_traits<char>, |
188 StackAllocator<char, stack_capacity> >, | 189 StackAllocator<char, stack_capacity> >, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 // operator-> (using "->at()" does exception stuff we don't want). | 257 // operator-> (using "->at()" does exception stuff we don't want). |
257 T& operator[](size_t i) { return this->container().operator[](i); } | 258 T& operator[](size_t i) { return this->container().operator[](i); } |
258 const T& operator[](size_t i) const { | 259 const T& operator[](size_t i) const { |
259 return this->container().operator[](i); | 260 return this->container().operator[](i); |
260 } | 261 } |
261 }; | 262 }; |
262 | 263 |
263 } // namespace base | 264 } // namespace base |
264 | 265 |
265 #endif // BASE_CONTAINERS_STACK_CONTAINER_H_ | 266 #endif // BASE_CONTAINERS_STACK_CONTAINER_H_ |
OLD | NEW |