Reputation: 2735
I have a std::pair declaration shown in below code snippet and g++ issues below compilation error at line 152 saying "error: wrong number of template arguments (1, should be 2)". I am new to this std::pair thing and I wonder what I am doing wrong. So mentioned line number has been marked in the code snippet below. Thanks.
std::vector<
std::pair<EndPointAddr* requesterServiceAddr,
EndPointAddr* requestedServiceAddr>* //LINE 152 is HERE
> mServiceSubscriptionsList;
In file included from ServiceRegistrar.hpp:8:0,
from ServiceRegistrar.cpp:7:
../control_api/ServiceRegistrarAPI.hpp:152:95: error: wrong number of template arguments (1, should be 2)
........
.......
../control_api/ServiceRegistrarAPI.hpp:153:14: error: template argument 1 is invalid
../control_api/ServiceRegistrarAPI.hpp:153:14: error: template argument 2 is invalid
In file included from ../control_api/ServiceRegistrarAPI.cpp:5:0:
Upvotes: 2
Views: 3213
Reputation: 63735
std::pair
Only needs the types in a declaration.
std::vector<
std::pair<EndPointAddr*,
EndPointAddr* >* //LINE 152 is HERE
> mServiceSubscriptionsList;
Upvotes: 2
Reputation: 49221
You need to put a type as a template argument, not a variable:
std::vector< std::pair<EndPointAddr*, EndPointAddr*>* >
Upvotes: 2