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

Unified Diff: courgette/memory_allocator.h

Issue 2476863004: [Courgette] AssemblyProgram: Serialize data to single raw buffer, instead of storing pointer of obj… (Closed)
Patch Set: Sync and merge. Created 4 years, 1 month 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 | « courgette/courgette.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/memory_allocator.h
diff --git a/courgette/memory_allocator.h b/courgette/memory_allocator.h
index e1d8573df8effa0baba605b2129224e99286fcd6..5b402d37d9bae704e31b7d67e1689095e73b0ebf 100644
--- a/courgette/memory_allocator.h
+++ b/courgette/memory_allocator.h
@@ -5,9 +5,9 @@
#ifndef COURGETTE_MEMORY_ALLOCATOR_H_
#define COURGETTE_MEMORY_ALLOCATOR_H_
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
+#include <cstddef>
+#include <cstdint>
+#include <cstdlib>
#include "base/compiler_specific.h"
#include "base/files/file.h"
@@ -331,7 +331,10 @@ class MemoryAllocator {
template<typename T, class Allocator = MemoryAllocator<T> >
class NoThrowBuffer {
public:
- typedef T value_type;
+ using value_type = T;
+ using iterator = T*;
+ using const_iterator = const T*;
+
static const size_t kAllocationFailure = 0xffffffff;
static const size_t kStartSize = sizeof(T) > 0x100 ? 1 : 0x100 / sizeof(T);
@@ -443,25 +446,25 @@ class NoThrowBuffer {
return buffer_[size_ - 1];
}
- const T* begin() const {
+ const_iterator begin() const {
if (!size_)
return NULL;
return buffer_;
}
- T* begin() {
+ iterator begin() {
if (!size_)
return NULL;
return buffer_;
}
- const T* end() const {
+ const_iterator end() const {
if (!size_)
return NULL;
return buffer_ + size_;
}
- T* end() {
+ iterator end() {
if (!size_)
return NULL;
return buffer_ + size_;
« no previous file with comments | « courgette/courgette.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698