请告诉我如何在语法上更正这一行:
m_instance.reset(new T(std::forward < Args > (args) ...));
使用std::make_unique?不管我怎么试,它都写它不能匹配模板参数_Ty,找不到对应的重载函数等等。
template < typename ... Args >
static void construct(Args && ... args)
{
m_instance.reset(new T(std::forward < Args > (args) ...));
}
这是模板类的静态函数的一般形式。m_instance- 这个static std::unique_ptr < T >。我想删除new并设置m_instance通过make_uniuque,像这样:m_instance(std::make_unique( /* а тут что ? */ ))。怎么写...?std::make_unique
在问这个问题之前你尝试了什么?答案很简单: