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

Unified Diff: src/IceDefs.h

Issue 1367403004: Subzero: Add missing content to CfgLocalAllocator. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceDefs.h
diff --git a/src/IceDefs.h b/src/IceDefs.h
index 5f96d7e7e5bb6bbaf1f942ba662b1d896c8a5f97..f58ebe9c9677a40f1af7ed4fdff810672fe6480b 100644
--- a/src/IceDefs.h
+++ b/src/IceDefs.h
@@ -80,12 +80,22 @@ ArenaAllocator<> *getCurrentCfgAllocator();
template <typename T> struct CfgLocalAllocator {
using value_type = T;
+ using pointer = T *;
+ using const_pointer = const T *;
+ using reference = T &;
+ using const_reference = const T &;
+ using size_type = std::size_t;
CfgLocalAllocator() = default;
template <class U> CfgLocalAllocator(const CfgLocalAllocator<U> &) {}
- T *allocate(std::size_t Num) {
+ pointer allocate(size_type Num) {
return getCurrentCfgAllocator()->Allocate<T>(Num);
}
- void deallocate(T *, std::size_t) {}
+ void deallocate(pointer, size_type) {}
+ template <class U> struct rebind { typedef CfgLocalAllocator<U> other; };
+ void construct(pointer P, const T &Val) {
+ new (static_cast<void *>(P)) T(Val);
+ }
+ void destroy(pointer P) { P->~T(); }
};
template <typename T, typename U>
inline bool operator==(const CfgLocalAllocator<T> &,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698