Can someone explain how to resolve the ambiguous overload warning for make_unique, where the error occurs and what exactly it means (I understand what is ambiguous overload, but I'm not sure why I get one for this specific code)? I use C ++ 11, so 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 hovering over the tooltip in visual studio 13 gives me the following 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 should be the one called from the make_unique template
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 redirected to:
Shader(const std::string& name);
Error code
std::string _name = "Shader"; std::unique_ptr<Shader> s = make_unique<Shader>(_name);
source share