Lines Matching refs:T
37 template <typename T>
64 template <class T>
65 T* allocate() { in allocate()
66 return reinterpret_cast<T*>(allocate(sizeof(T))); in allocate()
75 template <class T>
76 using unique_ptr = std::unique_ptr<T, std::function<void(void*)>>;
78 template <class T, class... Args>
79 unique_ptr<T> make_unique(Args&&... args) { in make_unique()
81 return unique_ptr<T>(new (allocate<T>()) T(std::forward<Args>(args)...), [impl](void* ptr) { in make_unique()
82 reinterpret_cast<T*>(ptr)->~T(); in make_unique()
89 template <class T>
90 using shared_ptr = std::shared_ptr<T>;
92 template <class T, class... Args>
93 shared_ptr<T> make_shared(Args&&... args);
101 template <typename T>
104 using value_type = T;
119 STLAllocator<T>& operator=(const STLAllocator<T>&) = default;
121 T* allocate(std::size_t n) { return reinterpret_cast<T*>(heap_.allocate(n * sizeof(T))); } in allocate()
123 void deallocate(T* ptr, std::size_t) { heap_.deallocate(ptr); } in deallocate()
144 template <class T>
145 class Allocator : public STLAllocator<T> {
151 STLAllocator<T>(other) {} in Allocator()
156 STLAllocator<T>(other) {} in Allocator()
159 Allocator<T>& operator=(const Allocator<T>&) = default;
161 using STLAllocator<T>::allocate;
162 using STLAllocator<T>::deallocate;
163 using STLAllocator<T>::heap_;
165 T* allocate() { return STLAllocator<T>::allocate(1); } in allocate()
168 using shared_ptr = Heap::shared_ptr<T>;
172 return heap_.template make_shared<T>(std::forward<Args>(args)...); in make_shared()
175 using unique_ptr = Heap::unique_ptr<T>;
179 return heap_.template make_unique<T>(std::forward<Args>(args)...); in make_unique()
186 template <class T, class... Args>
187 inline Heap::shared_ptr<T> Heap::make_shared(Args&&... args) { in make_shared()
188 return std::allocate_shared<T, Allocator<T>, Args...>(Allocator<T>(*this), in make_shared()
194 template <class T>
195 using vector = std::vector<T, Allocator<T>>;
197 template <class T>
198 using list = std::list<T, Allocator<T>>;
200 template <class Key, class T, class Compare = std::less<Key>>
201 using map = std::map<Key, T, Compare, Allocator<std::pair<const Key, T>>>;
203 template <class Key, class T, class Hash = std::hash<Key>, class KeyEqual = std::equal_to<Key>>
205 std::unordered_map<Key, T, Hash, KeyEqual, Allocator<std::pair<const Key, T>>>;