6 #ifndef CPPTL_JSON_ALLOCATOR_H_INCLUDED
7 #define CPPTL_JSON_ALLOCATOR_H_INCLUDED
21 using const_pointer =
const T*;
23 using const_reference =
const T&;
24 using size_type = std::size_t;
25 using difference_type = std::ptrdiff_t;
32 return static_cast<pointer
>(::operator
new(n *
sizeof(T)));
43 std::memset(p, 0, n *
sizeof(T));
51 template<
typename... Args>
54 ::new (
static_cast<void*
>(p)) T(std::forward<Args>(args)...);
57 size_type max_size()
const {
58 return size_t(-1) /
sizeof(T);
61 pointer address( reference x )
const {
62 return std::addressof(x);
65 const_pointer address( const_reference x )
const {
66 return std::addressof(x);
79 template<
typename U> SecureAllocator(
const SecureAllocator<U>&) {}
84 template<
typename T,
typename U>
89 template<
typename T,
typename U>
90 bool operator!=(
const SecureAllocator<T>&,
const SecureAllocator<U>&) {
tBool operator!=(const tErrorCode &lhs, const tErrorCode &rhs)
Compare two POD error code types for inequality.
tBool operator==(const tErrorCode &lhs, const tErrorCode &rhs)
Compare two POD error code types for equality.
pointer allocate(size_type n)
Allocate memory for N items using the standard allocator.
void deallocate(volatile pointer p, size_type n)
Release memory which was allocated for N items at pointer P.
void construct(pointer p, Args &&... args)
Construct an item in-place at pointer P.
void destroy(pointer p)
Destroy an item in-place at pointer P.
JSON (JavaScript Object Notation).