20 class dynamic_disposables_container
23 explicit dynamic_disposables_container() =
default;
25 dynamic_disposables_container(
const dynamic_disposables_container&) =
delete;
26 dynamic_disposables_container(dynamic_disposables_container&& other)
noexcept =
default;
28 dynamic_disposables_container& operator=(
const dynamic_disposables_container& other) =
delete;
29 dynamic_disposables_container& operator=(dynamic_disposables_container&& other)
noexcept =
default;
38 m_data.push_back(std::move(d));
43 m_data.erase(std::remove(m_data.begin(), m_data.end(), d), m_data.end());
48 for (
const auto& d : m_data)
60 mutable std::vector<rpp::disposable_wrapper> m_data{};
64 class static_disposables_container
67 static_disposables_container() =
default;
68 static_disposables_container(
const static_disposables_container&) =
delete;
69 static_disposables_container& operator=(
const static_disposables_container& other) =
delete;
71 static_disposables_container& operator=(static_disposables_container&& other)
noexcept
76 m_size = other.m_size;
77 for (
size_t i = 0; i < m_size; ++i)
78 std::construct_at(get(i), std::move(*other.get(i)));
84 static_disposables_container(static_disposables_container&& other)
noexcept
86 *
this = std::move(other);
89 ~static_disposables_container()
noexcept
98 std::construct_at(get(m_size++), d);
105 std::construct_at(get(m_size++), std::move(d));
110 for (
size_t i = 0; i < m_size;)
118 for (
size_t j = i + 1; j < m_size; ++j)
119 *get(j - 1) = std::move(*get(j));
121 std::destroy_at(get(--m_size));
127 for (
size_t i = 0; i < m_size; ++i)
135 for (
size_t i = 0; i < m_size; ++i)
136 std::destroy_at(get(i));