vendredi 8 septembre 2017

SFINAE make unique

Is there a way to check whether type T is constructible with variadic template arguments pack Args... ? I don't care whether the solution will be efficient or not I just want to SFINAE or static assert in debug mode.

template<typename T, typename... Args>
std::unique_ptr<T> make_unique(Args&&... args)
{
    return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}

Aucun commentaire:

Enregistrer un commentaire