Allocator Builder
Policy Based C++ Template Allocator Library
Main Page
Related Pages
Modules
Classes
Files
File List
All
Classes
Functions
Variables
Enumerations
Enumerator
Groups
Pages
array_creation_evaluator.cpp
1
//
3
// Copyright 2014 Felix Petriconi
4
//
5
// License: http://boost.org/LICENSE_1_0.txt, Boost License 1.0
6
//
7
// Authors: http://petriconi.net, Felix Petriconi
8
//
10
11
#include "array_creation_evaluator.hpp"
12
#include <new>
13
#include <stddef.h>
14
15
namespace
16
{
17
struct
Test
18
{
19
Test() : v(0)
20
{
21
s[0] =
'\0'
;
22
}
23
24
~Test()
25
{
26
s[0] =
'\0'
;
27
}
28
29
int
v;
30
char
s[2];
31
};
32
33
size_t
array_offset_internal()
34
{
35
alignas
(Test)
char
buffer[
sizeof
(Test) * 6];
36
Test* p =
new
(buffer) Test[5];
37
38
return
reinterpret_cast<
char
*
>
(p) - buffer;
39
}
40
}
41
42
43
size_t
alb::v_100::helpers::array_offset()
44
{
45
static
size_t
result = array_offset_internal();
46
return
result;
47
}
source
array_creation_evaluator.cpp
Generated on Sun Nov 15 2015 20:28:19 for Allocator Builder by
1.8.6