The issue is that you are constructing the vector using a brace-enclosed initialization list. That favours the std::initializer_list<T>
constructor when applicable. In this case, the size_t
, -1.0
list is compatible with std::initializer_list<double>
, so that constructor gets picked. You need to use the old-style, C++03 construction:
std::vector<double> bestScores(s, -1.0);
This is one of the gotchas of brace-enclosed initializers. They don't play well for certain standard library container instantiations. You have to remember that the std::initializer_list
constructor will trump the others.