src
Main Page
Namespaces
Classes
Files
File List
File Members
util
allocate.h
Go to the documentation of this file.
1
#ifndef _RE2C_UTIL_ALLOCATE_
2
#define _RE2C_UTIL_ALLOCATE_
3
4
#include <stddef.h>
// size_t
5
6
namespace
re2c
{
7
8
// useful fof allocation of arrays of POD objects
9
// 'new []' invokes default constructor for each object
10
// this can be unacceptable for performance reasons
11
template
<
typename
T> T *
allocate
(
size_t
n)
12
{
13
void
* p =
operator
new
(n *
sizeof
(T));
14
return
static_cast<
T *
>
(p);
15
}
16
17
}
// namespace re2c
18
19
#endif // _RE2C_UTIL_ALLOCATE_
re2c::allocate
T * allocate(size_t n)
Definition:
allocate.h:11
re2c
Definition:
bitmap.cc:10
Generated by
1.8.10