Fix g_fxo->init internal logic for CTAD (use () not {})

Also improve comments to the functions.
This commit is contained in:
Nekotekina 2020-02-25 14:31:26 +03:00
parent 9c9c2eb2c9
commit 136d769895

View file

@ -165,15 +165,16 @@ namespace stx
return obj;
}
// Special stuff
template <template <class...> typename CTAD, typename... Args>
// CTAD adaptor for init (see init description), accepts template not type
template <template <class X, class...> typename Template, typename... Args>
auto init(Args&&... args) noexcept
{
using T = decltype(CTAD{std::forward<Args>(args)...});
// Deduce the type from given template and its arguments
using T = decltype(Template(std::forward<Args>(args)...));
return init<T>(std::forward<Args>(args)...);
}
// Obtain object pointer (the only thread safe function)
// Obtain object pointer (thread safe just against other get calls)
template <typename T>
T* get() const noexcept
{