Could someone please explain how to resolve the ambigious overload warning for make_unique, where the error comes from and what it does exactly mean (I do understand what an ambigious overload is but I am unsure why I get one for this particular code)? I am using c++11, therefore I use the recommended template from Herb Sutter.
Using it I get the following error:
Error 4 error C2668: 'make_unique' : ambiguous call to overloaded function
And the hover over tooltip in visual studio 13 gives me the following to methods:
function template "std::enable_if<!std::is_array<_Ty>::value, std::unique_ptr<_Ty,std::default_delete<_Ty>>>::type std::make_unique<_Ty,_Types...>(_Types &&..._Args)"
function template "std::unique_ptr<T, std::default_delete<T>> make_unique<T,Args...>(Args...)
argument types are: std::string
The second one should be the one called from the make_unique template
/* Will be part of c++14 and is just an oversight in c++11
* From: http://herbsutter.com/gotw/_102/
*/
template<typename T, typename ...Args>
std::unique_ptr<T> make_unique(Args&& ...args){
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
The constructor to be forwarded to:
Shader(const std::string& name);
The code generating the error
std::string _name = "Shader";
std::unique_ptr<Shader> s = make_unique<Shader>(_name);