Add g_fxo->init_crtp to simplify thread construction

This commit is contained in:
Nekotekina 2020-02-25 11:51:41 +03:00
parent 7eebe06931
commit fa02a04baa
3 changed files with 14 additions and 11 deletions

View file

@ -165,6 +165,14 @@ namespace stx
return obj;
}
// Special stuff
template <template <class...> typename CTAD, typename... Args>
auto init_crtp(Args&&... args) noexcept
{
using T = decltype(CTAD{std::forward<Args>(args)...});
return init<T>(std::forward<Args>(args)...);
}
// Obtain object pointer (the only thread safe function)
template <typename T>
T* get() const noexcept