OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 TOOLS_GN_ORDERED_SET_H_ | 5 #ifndef TOOLS_GN_ORDERED_SET_H_ |
6 #define TOOLS_GN_ORDERED_SET_H_ | 6 #define TOOLS_GN_ORDERED_SET_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 |
8 #include <set> | 10 #include <set> |
9 | 11 |
10 // An ordered set of items. Only appending is supported. Iteration is designed | 12 // An ordered set of items. Only appending is supported. Iteration is designed |
11 // to be by index. | 13 // to be by index. |
12 template<typename T> | 14 template<typename T> |
13 class OrderedSet { | 15 class OrderedSet { |
14 private: | 16 private: |
15 typedef std::set<T> set_type; | 17 typedef std::set<T> set_type; |
16 typedef typename set_type::const_iterator set_iterator; | 18 typedef typename set_type::const_iterator set_iterator; |
17 typedef std::vector<set_iterator> vector_type; | 19 typedef std::vector<set_iterator> vector_type; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 for (size_t i = 0; i < other.size(); i++) | 62 for (size_t i = 0; i < other.size(); i++) |
61 push_back(other[i]); | 63 push_back(other[i]); |
62 } | 64 } |
63 | 65 |
64 private: | 66 private: |
65 set_type set_; | 67 set_type set_; |
66 vector_type ordering_; | 68 vector_type ordering_; |
67 }; | 69 }; |
68 | 70 |
69 #endif // TOOLS_GN_ORDERED_SET_H_ | 71 #endif // TOOLS_GN_ORDERED_SET_H_ |
OLD | NEW |