mirror of
https://github.com/matrix-construct/construct
synced 2024-11-19 08:21:09 +01:00
ircd::util: Remove impossible semantics for instance_list.
This commit is contained in:
parent
68c863e7f9
commit
671053de74
1 changed files with 17 additions and 25 deletions
|
@ -38,31 +38,23 @@ struct ircd::util::instance_list
|
|||
protected:
|
||||
typename decltype(list)::iterator it;
|
||||
|
||||
instance_list(typename decltype(list)::iterator it)
|
||||
:it{std::move(it)}
|
||||
{}
|
||||
instance_list();
|
||||
instance_list(instance_list &&) = delete;
|
||||
instance_list(const instance_list &) = delete;
|
||||
instance_list &operator=(instance_list &&) = delete;
|
||||
instance_list &operator=(const instance_list &) = delete;
|
||||
~instance_list() noexcept;
|
||||
};
|
||||
|
||||
instance_list()
|
||||
template<class T>
|
||||
ircd::util::instance_list<T>::instance_list()
|
||||
:it{list.emplace(end(list), static_cast<T *>(this))}
|
||||
{}
|
||||
|
||||
instance_list(const instance_list &) = delete;
|
||||
instance_list(instance_list &&o) noexcept
|
||||
:it{std::move(o.it)}
|
||||
template<class T>
|
||||
ircd::util::instance_list<T>::~instance_list()
|
||||
noexcept
|
||||
{
|
||||
o.it = end(list);
|
||||
}
|
||||
|
||||
instance_list &operator=(const instance_list &) = delete;
|
||||
instance_list &operator=(instance_list &&o) noexcept
|
||||
{
|
||||
std::swap(it, o.it);
|
||||
return *this;
|
||||
}
|
||||
|
||||
~instance_list() noexcept
|
||||
{
|
||||
if(it != end(list))
|
||||
assert(it != end(list));
|
||||
list.erase(it);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue