While compiling my code I am getting the following error. Why is throwing an error if there is only one candidate?. Why can’t it can use it?
error: no matching function for call to ‘
TemplateParameters::reset_template_params( const char [8], const char [11], std::vector<const Channel*>, bool, std::map<int, String, std::less<int>, std::allocator<std::pair<const int, String> > >& )‘
note: candidates are:
void TemplateParameters::reset_template_params( String, String, std::vector<const Channel*>&, bool, std::map<int, String, std::less<int>, std::allocator<std::pair<const int, String> > >& )
There are two differences between the call and the candidate:
The first two
Stringarguments. If no implicit conversion from a C-string literal to this class exists, the call isn’t possible.The
vectorvs.vector¶meter. I’m going out on a limb and assume that you are passing a temporary to a newly created vector to the function. The compiler doesn’t allow this since you cannot bind a temporary to a non-const reference. Using a const-reference instead would work here. But that of course means that the parameter cannot be modified inside the method.Since you didn’t show how you called the code this is of course idle speculation.