Reputation: 17
I'm trying to make a vector of pairs, a object in first and a list of object pointers in second. However, I keep getting this error that there is no matching function.
Query blank_query();
std::list<Movie_Data*> blank_list;
std::vector<std::pair<Query,std::list<Movie_Data*>>> vec (Hsize,std::make_pair(blank_query,blank_list));
I'm getting this error
hash_table.cpp:128:47: error: no matching function for call to ‘std::vector<std::pair<Query, std::__cxx11::list<Movie_Data*> > >::vector(int&, std::pair<Query (*)(), std::__cxx11::list<Movie_Data*> >)’
(Hsize,std::make_pair(blank_query,blank_list));
Another example
hash_tbl.push_back(std::make_pair(blank_query,blank_list));
Error
hash_table.cpp:177:61: error: no matching function for call to ‘std::vector<std::pair<Query, std::__cxx11::list<Movie_Data*> > >::push_back(std::pair<Query (*)(), std::__cxx11::list<Movie_Data*> >)’
hash_tbl.push_back(std::make_pair(blank_query,blank_list));
Upvotes: 0
Views: 45
Reputation: 60227
You are a victim of a vexing parse. This line
Query blank_query();
actually declares a function named blank_query
, that takes no arguments, and returns a Query
.
You need to do something like:
Query blank_query{};
to create a Query
object.
Upvotes: 1