Sources Pipelines Documentation

Allocators  
segregator.hpp
1 // Copyright (c) 2016 Lukasz Laszko
2 //
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 #pragma once
6 
7 #include <boost/memory/memory_block.hpp>
8 
9 
10 namespace boost { namespace memory {
11 
27 template <
28  std::size_t threshold,
29  typename primary_allocator,
30  typename secondary_allocator>
32 {
33 public:
40  memory_block allocate(std::size_t size);
41 
47  void deallocate(memory_block& block);
48 
55  bool owns(memory_block& block);
56 
62  primary_allocator& get_primary() noexcept;
63 
69  secondary_allocator& get_secondary() noexcept;
70 
71 private:
72  primary_allocator primary_;
73  secondary_allocator secondary_;
74 };
75 
76 } }
77 
78 #include "segregator.ipp"
79 
secondary_allocator & get_secondary() noexcept
Gets a reference to the secondary allocator.
Definition: segregator.ipp:71
void deallocate(memory_block &block)
Deallocates the given memory_block if possible.
Definition: segregator.ipp:32
primary_allocator & get_primary() noexcept
Gets a reference to the primary allocator.
Definition: segregator.ipp:59
memory_block allocate(std::size_t size)
Allocates a memory block of the given size.
Definition: segregator.ipp:17
bool owns(memory_block &block)
Checks if the given memory block has been allocated by this allocator.
Definition: segregator.ipp:47
Represents an allocated memory block.
Segregates allocation strategies according to the given allocation size threshold.
Definition: segregator.hpp:31