FastLED 3.9.15
Loading...
Searching...
No Matches

◆ allocate()

template<typename T>
T * fl::allocator< T >::allocate ( size_t n)
inline

Definition at line 65 of file allocator.h.

65 {
66 if (n == 0) {
67 return nullptr; // Handle zero allocation
68 }
69 void *ptr = malloc(sizeof(T) * n);
70 if (ptr == nullptr) {
71 return nullptr; // Handle allocation failure
72 }
73 memset(ptr, 0, sizeof(T) * n); // Zero-initialize the memory
74 return static_cast<T*>(ptr);
75 }