diff options
author | Jacques Lucke <mail@jlucke.com> | 2020-02-10 15:54:57 +0300 |
---|---|---|
committer | Jacques Lucke <mail@jlucke.com> | 2020-02-10 16:09:01 +0300 |
commit | 68cc982dcb7c1063a96f7ec9b7ccb95da4919d6b (patch) | |
tree | 9d2076363b54cb6b6da96064453ac3499a5f65c8 /source/blender/blenlib/BLI_allocator.h | |
parent | 76208a5670bc9d70f99f22a3c49463959461b5c1 (diff) |
BLI: improve various C++ data structures
The changes come from the `functions` branch, where I'm using
these structures a lot.
This also includes a new `BLI::Optional<T>` type, which is similar
to `std::Optional<T>` which can be used when Blender starts using
C++17.
Diffstat (limited to 'source/blender/blenlib/BLI_allocator.h')
-rw-r--r-- | source/blender/blenlib/BLI_allocator.h | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/source/blender/blenlib/BLI_allocator.h b/source/blender/blenlib/BLI_allocator.h index 82cf76e425c..075c181833c 100644 --- a/source/blender/blenlib/BLI_allocator.h +++ b/source/blender/blenlib/BLI_allocator.h @@ -36,7 +36,6 @@ #include "BLI_utildefines.h" #include "BLI_math_base.h" -#include "BLI_temporary_allocator.h" namespace BLI { @@ -53,7 +52,6 @@ class GuardedAllocator { void *allocate_aligned(uint size, uint alignment, const char *name) { - alignment = std::max<uint>(alignment, 8); return MEM_mallocN_aligned(size, alignment, name); } @@ -102,29 +100,6 @@ class RawAllocator { } }; -/** - * Use this only under specific circumstances as described in BLI_temporary_allocator.h. - */ -class TemporaryAllocator { - public: - void *allocate(uint size, const char *UNUSED(name)) - { - return BLI_temporary_allocate(size); - } - - void *allocate_aligned(uint size, uint alignment, const char *UNUSED(name)) - { - BLI_assert(alignment <= 64); - UNUSED_VARS_NDEBUG(alignment); - return BLI_temporary_allocate(size); - } - - void deallocate(void *ptr) - { - BLI_temporary_deallocate(ptr); - } -}; - } // namespace BLI #endif /* __BLI_ALLOCATOR_H__ */ |