0
0
Fork 0
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:
Jason Volk 2018-05-06 16:39:28 -07:00
parent 68c863e7f9
commit 671053de74

View file

@ -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);
}
};