File tree 2 files changed +9
-12
lines changed
2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 1
1
// This file is part of meshoptimizer library; see meshoptimizer.h for version/license details
2
2
#include " meshoptimizer.h"
3
3
4
+ meshopt_alloc_t meshopt_Allocator::Storage::allocate = operator new ;
5
+ meshopt_dealloc_t meshopt_Allocator::Storage::deallocate = operator delete ;
6
+
4
7
void meshopt_setAllocator (void * (MESHOPTIMIZER_ALLOC_CALLCONV* allocate)(size_t ), void (MESHOPTIMIZER_ALLOC_CALLCONV* deallocate)(void *))
5
8
{
6
9
meshopt_Allocator::Storage::allocate = allocate;
Original file line number Diff line number Diff line change @@ -813,18 +813,18 @@ inline int meshopt_quantizeSnorm(float v, int N)
813
813
814
814
/* Internal implementation helpers */
815
815
#ifdef __cplusplus
816
+ typedef void * (MESHOPTIMIZER_ALLOC_CALLCONV *meshopt_alloc_t )(size_t );
817
+ typedef void (MESHOPTIMIZER_ALLOC_CALLCONV *meshopt_dealloc_t )(void *);
818
+
816
819
class meshopt_Allocator
817
820
{
818
821
public:
819
- template <typename T>
820
- struct StorageT
822
+ struct Storage
821
823
{
822
- static void * (MESHOPTIMIZER_ALLOC_CALLCONV* allocate)( size_t ) ;
823
- static void (MESHOPTIMIZER_ALLOC_CALLCONV* deallocate)( void *) ;
824
+ static meshopt_alloc_t allocate;
825
+ static meshopt_dealloc_t deallocate;
824
826
};
825
827
826
- typedef StorageT<void > Storage;
827
-
828
828
meshopt_Allocator ()
829
829
: blocks()
830
830
, count(0 )
@@ -857,12 +857,6 @@ class meshopt_Allocator
857
857
void * blocks[24 ];
858
858
size_t count;
859
859
};
860
-
861
- // This makes sure that allocate/deallocate are lazily generated in translation units that need them and are deduplicated by the linker
862
- template <typename T>
863
- void * (MESHOPTIMIZER_ALLOC_CALLCONV* meshopt_Allocator::StorageT<T>::allocate)(size_t ) = operator new ;
864
- template <typename T>
865
- void (MESHOPTIMIZER_ALLOC_CALLCONV* meshopt_Allocator::StorageT<T>::deallocate)(void *) = operator delete ;
866
860
#endif
867
861
868
862
/* Inline implementation for C++ templated wrappers */
You can’t perform that action at this time.
0 commit comments