xenium
orphan.hpp
1//
2// Copyright (c) 2018-2020 Manuel Pöter.
3// Licensed under the MIT License. See LICENSE file in the project root for full license information.
4//
5
6#ifndef XENIUM_DETAIL_ORPHAN_HPP
7#define XENIUM_DETAIL_ORPHAN_HPP
8
9#include <xenium/reclamation/detail/deletable_object.hpp>
10#include <array>
11
12namespace xenium { namespace reclamation { namespace detail
13{
14
15template <unsigned Epochs>
16struct orphan : detail::deletable_object_impl<orphan<Epochs>>
17{
18 orphan(unsigned target_epoch, std::array<detail::deletable_object*, Epochs> &retire_lists):
19 target_epoch(target_epoch),
20 retire_lists(retire_lists)
21 {}
22
23 ~orphan()
24 {
25 for (auto p: retire_lists)
26 detail::delete_objects(p);
27 }
28
29 const unsigned target_epoch;
30private:
31 std::array<detail::deletable_object*, Epochs> retire_lists;
32};
33
34}}}
35
36#endif