Vladimir Marko | 69f08ba | 2014-04-11 12:28:11 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ART_COMPILER_UTILS_SCOPED_ARENA_CONTAINERS_H_ |
| 18 | #define ART_COMPILER_UTILS_SCOPED_ARENA_CONTAINERS_H_ |
| 19 | |
Vladimir Marko | 622bdbe | 2014-06-19 14:59:05 +0100 | [diff] [blame] | 20 | #include <deque> |
| 21 | #include <queue> |
Vladimir Marko | 69f08ba | 2014-04-11 12:28:11 +0100 | [diff] [blame] | 22 | #include <set> |
Vladimir Marko | 622bdbe | 2014-06-19 14:59:05 +0100 | [diff] [blame] | 23 | #include <vector> |
Vladimir Marko | 69f08ba | 2014-04-11 12:28:11 +0100 | [diff] [blame] | 24 | |
| 25 | #include "utils/scoped_arena_allocator.h" |
| 26 | #include "safe_map.h" |
| 27 | |
| 28 | namespace art { |
| 29 | |
| 30 | template <typename T> |
Vladimir Marko | 622bdbe | 2014-06-19 14:59:05 +0100 | [diff] [blame] | 31 | using ScopedArenaDeque = std::deque<T, ScopedArenaAllocatorAdapter<T>>; |
| 32 | |
| 33 | template <typename T> |
| 34 | using ScopedArenaQueue = std::queue<T, ScopedArenaDeque<T>>; |
| 35 | |
| 36 | template <typename T> |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 37 | using ScopedArenaVector = std::vector<T, ScopedArenaAllocatorAdapter<T>>; |
Vladimir Marko | 69f08ba | 2014-04-11 12:28:11 +0100 | [diff] [blame] | 38 | |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 39 | template <typename T, typename Comparator = std::less<T>> |
| 40 | using ScopedArenaSet = std::set<T, Comparator, ScopedArenaAllocatorAdapter<T>>; |
Vladimir Marko | 69f08ba | 2014-04-11 12:28:11 +0100 | [diff] [blame] | 41 | |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 42 | template <typename K, typename V, typename Comparator = std::less<K>> |
Vladimir Marko | 69f08ba | 2014-04-11 12:28:11 +0100 | [diff] [blame] | 43 | using ScopedArenaSafeMap = |
Ian Rogers | 700a402 | 2014-05-19 16:49:03 -0700 | [diff] [blame] | 44 | SafeMap<K, V, Comparator, ScopedArenaAllocatorAdapter<std::pair<const K, V>>>; |
Vladimir Marko | 69f08ba | 2014-04-11 12:28:11 +0100 | [diff] [blame] | 45 | |
| 46 | } // namespace art |
| 47 | |
| 48 | #endif // ART_COMPILER_UTILS_SCOPED_ARENA_CONTAINERS_H_ |