Sierra Toolkit
Version of the Day
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
allocator_rdestl.h
1
#ifndef RDESTL_ALLOCATOR_H
2
#define RDESTL_ALLOCATOR_H
3
4
namespace
rde
5
{
6
7
// CONCEPT!
8
class
allocator
9
{
10
public
:
11
explicit
allocator(
const
char
* name =
"DEFAULT"
): m_name(name) {}
12
// Copy ctor generated by compiler.
13
// allocator(const allocator&)
14
~allocator() {}
15
16
// Generated by compiler.
17
//allocator& operator=(const allocator&)
18
19
void
* allocate(
unsigned
int
bytes,
int
flags = 0);
20
// Not supported for standard allocator for the time being.
21
void
* allocate_aligned(
unsigned
int
bytes,
unsigned
int
alignment,
int
flags = 0);
22
void
deallocate(
void
* ptr,
unsigned
int
bytes);
23
24
const
char
* get_name()
const
;
25
26
private
:
27
const
char
* m_name;
28
};
29
30
// True if lhs can free memory allocated by rhs and vice-versa.
31
inline
bool
operator==(
const
allocator&
/*lhs*/
,
const
allocator&
/*rhs*/
)
32
{
33
return
true
;
34
}
35
inline
bool
operator!=(
const
allocator& lhs,
const
allocator& rhs)
36
{
37
return
!(lhs == rhs);
38
}
39
40
inline
void
* allocator::allocate(
unsigned
int
bytes,
int
)
41
{
42
return
operator
new
(bytes);
43
}
44
45
inline
void
allocator::deallocate(
void
* ptr,
unsigned
int
)
46
{
47
operator
delete
(ptr);
48
}
49
50
}
// namespace rde
51
52
//-----------------------------------------------------------------------------
53
#endif // #ifndef RDESTL_ALLOCATOR_H
stk_util
stk_util
util
unused-maps
allocator_rdestl.h
Generated on Wed Sep 26 2018 14:44:33 for Sierra Toolkit by
1.8.6