diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:17:24 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-04-17 07:21:24 +0300 |
commit | e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch) | |
tree | 8cf3453d12edb177a218ef8009357518ec6cab6a /intern/memutil/MEM_Allocator.h | |
parent | b3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff) |
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211.
For details on usage and instructions for migrating branches
without conflicts, see:
https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'intern/memutil/MEM_Allocator.h')
-rw-r--r-- | intern/memutil/MEM_Allocator.h | 126 |
1 files changed, 69 insertions, 57 deletions
diff --git a/intern/memutil/MEM_Allocator.h b/intern/memutil/MEM_Allocator.h index 229a7c46b2c..dc7ddcefeeb 100644 --- a/intern/memutil/MEM_Allocator.h +++ b/intern/memutil/MEM_Allocator.h @@ -18,68 +18,80 @@ * \ingroup memutil */ - #ifndef __MEM_ALLOCATOR_H__ #define __MEM_ALLOCATOR_H__ #include <stddef.h> #include "guardedalloc/MEM_guardedalloc.h" -template<typename _Tp> -struct MEM_Allocator -{ - typedef size_t size_type; - typedef ptrdiff_t difference_type; - typedef _Tp* pointer; - typedef const _Tp* const_pointer; - typedef _Tp& reference; - typedef const _Tp& const_reference; - typedef _Tp value_type; - - template<typename _Tp1> - struct rebind { - typedef MEM_Allocator<_Tp1> other; - }; - - MEM_Allocator() throw() {} - MEM_Allocator(const MEM_Allocator&) throw() {} - - template<typename _Tp1> - MEM_Allocator(const MEM_Allocator<_Tp1>) throw() { } - - ~MEM_Allocator() throw() {} - - pointer address(reference __x) const { return &__x; } - - const_pointer address(const_reference __x) const { return &__x; } - - // NB: __n is permitted to be 0. The C++ standard says nothing - // about what the return value is when __n == 0. - _Tp* allocate(size_type __n, const void* = 0) { - _Tp* __ret = NULL; - if (__n) - __ret = static_cast<_Tp*>( - MEM_mallocN(__n * sizeof(_Tp), - "STL MEM_Allocator")); - return __ret; - } - - // __p is not permitted to be a null pointer. - void deallocate(pointer __p, size_type) { - MEM_freeN(__p); - } - - size_type max_size() const throw() { - return size_t(-1) / sizeof(_Tp); - } - - void construct(pointer __p, const _Tp& __val) { - new(__p) _Tp(__val); - } - - void destroy(pointer __p) { - __p->~_Tp(); - } +template<typename _Tp> struct MEM_Allocator { + typedef size_t size_type; + typedef ptrdiff_t difference_type; + typedef _Tp *pointer; + typedef const _Tp *const_pointer; + typedef _Tp &reference; + typedef const _Tp &const_reference; + typedef _Tp value_type; + + template<typename _Tp1> struct rebind { + typedef MEM_Allocator<_Tp1> other; + }; + + MEM_Allocator() throw() + { + } + MEM_Allocator(const MEM_Allocator &) throw() + { + } + + template<typename _Tp1> MEM_Allocator(const MEM_Allocator<_Tp1>) throw() + { + } + + ~MEM_Allocator() throw() + { + } + + pointer address(reference __x) const + { + return &__x; + } + + const_pointer address(const_reference __x) const + { + return &__x; + } + + // NB: __n is permitted to be 0. The C++ standard says nothing + // about what the return value is when __n == 0. + _Tp *allocate(size_type __n, const void * = 0) + { + _Tp *__ret = NULL; + if (__n) + __ret = static_cast<_Tp *>(MEM_mallocN(__n * sizeof(_Tp), "STL MEM_Allocator")); + return __ret; + } + + // __p is not permitted to be a null pointer. + void deallocate(pointer __p, size_type) + { + MEM_freeN(__p); + } + + size_type max_size() const throw() + { + return size_t(-1) / sizeof(_Tp); + } + + void construct(pointer __p, const _Tp &__val) + { + new (__p) _Tp(__val); + } + + void destroy(pointer __p) + { + __p->~_Tp(); + } }; -#endif // __MEM_ALLOCATOR_H__ +#endif // __MEM_ALLOCATOR_H__ |