Toolbox snapshot
The Reactive C++ Toolbox
Loading...
Searching...
No Matches
Storage.hpp
Go to the documentation of this file.
1// The Reactive C++ Toolbox.
2// Copyright (C) 2013-2019 Swirly Cloud Limited
3// Copyright (C) 2022 Reactive Markets Limited
4//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
16
17#ifndef TOOLBOX_UTIL_STORAGE_HPP
18#define TOOLBOX_UTIL_STORAGE_HPP
19
21
22#include <memory>
23
24namespace toolbox {
25inline namespace util {
26namespace detail {
27template <std::size_t SizeN>
29 void operator()(void* ptr) const noexcept { deallocate(ptr, SizeN); }
30};
31} // namespace detail
32
33template <std::size_t SizeN>
34using StoragePtr = std::unique_ptr<void, detail::StorageDeleter<SizeN>>;
35
37template <std::size_t SizeN>
42
43} // namespace util
44} // namespace toolbox
45
46#endif // TOOLBOX_UTIL_STORAGE_HPP
StoragePtr< SizeN > make_storage()
Returns a block of dynamic storage acquired from the custom allocator.
Definition Storage.hpp:38
std::unique_ptr< void, detail::StorageDeleter< SizeN > > StoragePtr
Definition Storage.hpp:34
constexpr auto bind() noexcept
Definition Slot.hpp:92
TOOLBOX_WEAK void deallocate(void *ptr, size_t size) noexcept
Definition Allocator.cpp:30
TOOLBOX_WEAK void * allocate(size_t size)
Definition Allocator.cpp:25
void operator()(void *ptr) const noexcept
Definition Storage.hpp:29