libcopp  2.2.0
stack_allocator_posix.h
Go to the documentation of this file.
1 // Copyright 2023 owent
2 
3 #pragma once
4 
5 #include <libcopp/utils/config/libcopp_build_features.h>
6 
8 
9 #include <cstddef>
10 
11 #ifdef COPP_HAS_ABI_HEADERS
12 # include COPP_ABI_PREFIX
13 #endif
14 
15 LIBCOPP_COPP_NAMESPACE_BEGIN
16 struct stack_context;
17 
18 namespace allocator {
19 
24 class LIBCOPP_COPP_API stack_allocator_posix {
25  public:
26  stack_allocator_posix() LIBCOPP_MACRO_NOEXCEPT;
28  stack_allocator_posix(const stack_allocator_posix &other) LIBCOPP_MACRO_NOEXCEPT;
29  stack_allocator_posix &operator=(const stack_allocator_posix &other) LIBCOPP_MACRO_NOEXCEPT;
30  stack_allocator_posix(stack_allocator_posix &&other) LIBCOPP_MACRO_NOEXCEPT;
31  stack_allocator_posix &operator=(stack_allocator_posix &&other) LIBCOPP_MACRO_NOEXCEPT;
32 
38  void allocate(stack_context &, std::size_t) LIBCOPP_MACRO_NOEXCEPT;
39 
44  void deallocate(stack_context &) LIBCOPP_MACRO_NOEXCEPT;
45 };
46 } // namespace allocator
47 LIBCOPP_COPP_NAMESPACE_END
48 
49 #ifdef COPP_HAS_ABI_HEADERS
50 # include COPP_ABI_SUFFIX
51 #endif
memory allocator this allocator will create buffer using posix api and protect it