9#if !defined( __EMSCRIPTEN__ ) && !defined( MRMESH_NO_MIMALLOC )
10#define MR_ALLOCATOR_IS_MIMALLOC
19#ifdef MR_ALLOCATOR_IS_MIMALLOC
31template <
typename T,
typename =
void>
34inline constexpr std::size_t
cAllocatorAlignment<T, std::void_t<
decltype( T::cAllocAlignment )>> =
35 T::cAllocAlignment >
alignof( T ) ? T::cAllocAlignment :
alignof( T );
56#ifdef MR_ALLOCATOR_IS_MIMALLOC
61 if ( n > std::size_t( -1 ) /
sizeof( T ) )
62 throw std::bad_array_new_length();
70 [[nodiscard]] T * allocate( std::size_t n )
74 if ( n > std::size_t( -1 ) /
sizeof( T ) )
75 throw std::bad_array_new_length();
79 return std::allocator<T>().allocate( n );
81 void deallocate( T * p, std::size_t n )
noexcept
83 if constexpr ( cAllocatorAlignment<T> >
alignof( T ) )
84 ::operator
delete( p, std::align_val_t( cAllocatorAlignment<T> ) );
86 std::allocator<T>().deallocate( p, n );
92template <
typename T,
typename U>
#define MRMESH_API
Definition MRMeshFwd.h:85
constexpr std::size_t cAllocatorAlignment
the alignment of the memory Allocator<T> allocates: alignof( T ), or T::cAllocAlignment if T defines ...
Definition MRAllocator.h:32
bool operator==(const Allocator< T > &, const Allocator< U > &) noexcept
Definition MRAllocator.h:93
ImVec2 size(const ViewportRectangle &rect)
Definition MRViewport.h:59
void deallocate(T *p, std::size_t) noexcept
Definition MRAllocator.h:68
T * allocate(std::size_t n)
Definition MRAllocator.h:57
void * mimallocNewN(std::size_t count, std::size_t size)
void mimallocFree(void *p) noexcept
std::true_type propagate_on_container_move_assignment
Definition MRAllocator.h:54
Allocator() noexcept=default
T value_type
Definition MRAllocator.h:46
void * mimallocNewAligned(std::size_t size, std::size_t alignment)
Allocator< U > other
Definition MRAllocator.h:48
Allocator select_on_container_copy_construction() const noexcept
Definition MRAllocator.h:89
for internal use: namespace detail is not bound to other languages
Definition MRAllocator.h:23
Only strictly necessary for the bindings (to make MR::MeshIntersectionResult a complete type).
Definition MRCameraOrientationPlugin.h:8
Definition MRAllocator.h:48
Definition MRAllocator.h:45