mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2025-02-10 06:50:36 +00:00
20 lines
442 B
C
20 lines
442 B
C
|
#ifndef _RE2C_UTIL_ALLOCATE_
|
||
|
#define _RE2C_UTIL_ALLOCATE_
|
||
|
|
||
|
#include <stddef.h> // size_t
|
||
|
|
||
|
namespace re2c {
|
||
|
|
||
|
// useful fof allocation of arrays of POD objects
|
||
|
// 'new []' invokes default constructor for each object
|
||
|
// this can be unacceptable for performance reasons
|
||
|
template <typename T> T * allocate (size_t n)
|
||
|
{
|
||
|
void * p = operator new (n * sizeof (T));
|
||
|
return static_cast<T *> (p);
|
||
|
}
|
||
|
|
||
|
} // namespace re2c
|
||
|
|
||
|
#endif // _RE2C_UTIL_ALLOCATE_
|