shared_ptr.hpp: add invoke operator

This commit is contained in:
Nekotekina 2021-04-24 13:48:46 +03:00
parent 7197dd751a
commit e34c956196

View File

@ -258,6 +258,12 @@ namespace stx
}
}
template <typename... Args> requires (std::is_invocable_v<T, Args&&...>)
decltype(auto) operator()(Args&&... args) const noexcept
{
return std::invoke(*m_ptr, std::forward<Args>(args)...);
}
operator element_type*() const noexcept
{
return m_ptr;
@ -583,6 +589,12 @@ namespace stx
}
}
template <typename... Args> requires (std::is_invocable_v<T, Args&&...>)
decltype(auto) operator()(Args&&... args) const noexcept
{
return std::invoke(*m_ptr, std::forward<Args>(args)...);
}
usz use_count() const noexcept
{
if (m_ptr)