inline const list_type<type>& get_list(const type* = nullptr) const {\
return list;\
};\
inline list_type<type>& get_list(const type* = nullptr) {\
return list;\
};\
inline void insert(type& ptr) {\
auto& type_list = this->get_list((type*)nullptr);\
std::scoped_lock lock(list_mutex);\
ptr.cached_id = type::Id(type_list.size());
\
Eng3D::Log::debug(
"world_insert",
"Inserting object " #type
" with ID=" + std::to_string(
static_cast<size_t>(ptr.cached_id)));\
type_list.push_back(ptr);\
};\
inline void remove(type& ptr) {\
size_t cached_id = static_cast<size_t>(this->get_id<type>(ptr));\
auto& type_list = this->get_list((type*)nullptr);\
std::scoped_lock lock(list_mutex);\
cached_id = type_list.size();
\
Eng3D::Log::debug(
"world_remove",
"Removing object " #type
" with ID=" + std::to_string(
static_cast<size_t>(cached_id)));\
for(size_t i = cached_id + 1; i < type_list.size(); i++)\
type_list[i].cached_id = type::Id(static_cast<size_t>(type_list[i].cached_id) - 1);\
type_list.erase(type_list.begin() + cached_id);\
};\
list_type<type> list;