25#ifndef C_ALLOCATOR_SEC_HPP
26#define C_ALLOCATOR_SEC_HPP
51 std::enable_if_t< std::is_integral_v<T>,
bool> =
true>
72 typedef std::remove_const_t<T> value_type_mutable;
74 typedef value_type_mutable* pointer_mutable;
79#if __cplusplus > 201703L
87#if __cplusplus > 201703L
97#if __cplusplus > 201703L
103#if __cplusplus <= 201703L
109#if __cplusplus > 201703L
119#if __cplusplus > 201703L
122 ::free(
reinterpret_cast<void*
>(
const_cast<pointer_mutable
>(p) ) );
127 ::free(
reinterpret_cast<void*
>(
const_cast<pointer_mutable
>(p) ) );
134#if __cplusplus > 201703L
135template <
class T1,
class T2>
136 constexpr bool operator==(
const callocator_sec<T1>& lhs,
const callocator_sec<T2>& rhs)
noexcept {
141 return lhs.memory_usage == rhs.memory_usage;
149 template <
class T1,
class T2>
155 return lhs.memory_usage == rhs.memory_usage;
162 template <
class T1,
class T2>
void zero_bytes_sec(void *s, size_t n) noexcept __attrdecl_no_optimize__
Wrapper to ::explicit_bzero(), ::bzero() or ::memset(), whichever is available in that order.
__pack(...): Produces MSVC, clang and gcc compatible lead-in and -out macros.
bool operator==(const callocator< T1 > &lhs, const callocator< T2 > &rhs) noexcept
bool operator!=(const callocator< T1 > &lhs, const callocator< T2 > &rhs) noexcept
callocator_sec< U > other
A simple secure allocator for integral types using POSIX C functions: ::malloc() and ::free().
std::true_type is_always_equal
std::ptrdiff_t difference_type
value_type * allocate(std::size_t n)
std::true_type propagate_on_container_move_assignment
callocator_sec(const callocator_sec< U > &) noexcept
~callocator_sec()=default
callocator_sec() noexcept=default
const T & const_reference
value_type * allocate(std::size_t n, const void *)
callocator_sec(const callocator_sec &) noexcept
void deallocate(value_type *p, std::size_t n) noexcept