mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-02-14 06:40:53 +00:00
idm: Minor update to use std::static_pointer_cast
This commit is contained in:
parent
11b980c9ac
commit
93b8f3b5db
@ -423,7 +423,7 @@ public:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {found->second, static_cast<Get*>(found->second.get())};
|
return std::static_pointer_cast<Get>(found->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the object
|
// Get the object
|
||||||
@ -439,7 +439,7 @@ public:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {found->second, static_cast<Get*>(found->second.get())};
|
return std::static_pointer_cast<Get>(found->second);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the object, access object under reader lock
|
// Get the object, access object under reader lock
|
||||||
@ -568,21 +568,17 @@ public:
|
|||||||
template <typename T, typename Get = T>
|
template <typename T, typename Get = T>
|
||||||
static inline std::shared_ptr<Get> withdraw(u32 id)
|
static inline std::shared_ptr<Get> withdraw(u32 id)
|
||||||
{
|
{
|
||||||
std::shared_ptr<void> ptr;
|
std::shared_ptr<Get> ptr;
|
||||||
{
|
{
|
||||||
std::lock_guard lock(id_manager::g_mutex);
|
std::lock_guard lock(id_manager::g_mutex);
|
||||||
|
|
||||||
if (const auto found = find_id<T, Get>(id))
|
if (const auto found = find_id<T, Get>(id))
|
||||||
{
|
{
|
||||||
ptr = std::move(found->second);
|
ptr = std::static_pointer_cast<Get>(std::move(found->second));
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {ptr, static_cast<Get*>(ptr.get())};
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the ID after accessing the object under writer lock, return the object and propagate return value
|
// Remove the ID after accessing the object under writer lock, return the object and propagate return value
|
||||||
@ -598,8 +594,7 @@ public:
|
|||||||
if constexpr (std::is_void_v<FRT>)
|
if constexpr (std::is_void_v<FRT>)
|
||||||
{
|
{
|
||||||
func(*_ptr);
|
func(*_ptr);
|
||||||
std::shared_ptr<void> ptr = std::move(found->second);
|
return std::static_pointer_cast<Get>(std::move(found->second));
|
||||||
return {ptr, static_cast<Get*>(ptr.get())};
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -611,8 +606,7 @@ public:
|
|||||||
return {{found->second, _ptr}, std::move(ret)};
|
return {{found->second, _ptr}, std::move(ret)};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<void> ptr = std::move(found->second);
|
return {std::static_pointer_cast<Get>(std::move(found->second)), std::move(ret)};
|
||||||
return {{ptr, static_cast<Get*>(ptr.get())}, std::move(ret)};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user