Reputation: 2735
For the folowing line of code I am getting the below compilation error saying wrong number of template arguments. Can you please enlighten me what's wrong with this declaration? It looks ok to me. Content of ServicePartitionKey is given at the bottom.
//Line 107 where template arguments issue happens is this declaration line
std::map<ServicePartitionKey key, std::vector<EndPointAddr*>* > mServiceMap;
Compilation message:
In file included from ServiceRegistrar.hpp:8:0,
from ServiceRegistrar.cpp:7:
../control_api/ServiceRegistrarAPI.hpp:107:66: error: wrong number of template arguments (1, should be 4)
In file included from /usr/include/c++/4.7/map:61:0,
from ../control_api/ServiceRegistrarAPI.hpp:9,
from ServiceRegistrar.hpp:8,
from ServiceRegistrar.cpp:7:
Class ServicePartitionKey
#include <cstdint>
class ServicePartitionKey
{
public:
ServicePartitionKey() {};
ServicePartitionKey(uint32_t instanceNo, uint64_t version);
~ServicePartitionKey() {};
bool operator < (const ServicePartitionKey &rhs) const;
void setInstanceNo(uint32_t instanceNo) { mInstanceNo = instanceNo; }
uint32_t getInstanceNo() const { return mInstanceNo; }
void setVersion(uint64_t version) { mVersion = version; }
uint64_t getVersion() const { return mVersion; }
private:
uint32_t mInstanceNo;
uint64_t mVersion;
};
Upvotes: 0
Views: 583
Reputation: 110658
Template should just be types. You've given a declaration-like syntax for the first one:
std::map<ServicePartitionKey key, std::vector<EndPointAddr*>* > mServiceMap;
// ^^^
It should just be:
std::map<ServicePartitionKey, std::vector<EndPointAddr*>* > mServiceMap;
Upvotes: 6