-
November 3rd, 2015, 12:38 PM
#1
Issue in c
Hello,
I have a structure,
Code:
typedef map<string, PolicyRuleInfo> listOfPolicyRuleInfo;
struct IPAddressPolicyRulesInfo{
CIPAddress sIpAddress;
listOfPolicyRuleInfo policyRules;
IPAddressPolicyRulesInfo(){};
IPAddressPolicyRulesInfo(CIPAddress ipaddr, string policyRuleName, PolicyRuleInfo policyRule): sIpAddress(ipaddr){policyRules[policyRuleName]=policyRule;};
void addPolicycyRule(string policyRuleName, PolicyRuleInfo policyRule) { policyRules[policyRuleName]=policyRule; }
};
And somewhere in the code
IPAddressPolicyRulesInfo cIpAddressPolicyRulesInfo = iTerApn->second;
listOfPolicyRuleInfo itPolicyRule = cIpAddressPolicyRulesInfo.policyRules.find(sDedicatedBearerId);
if (itPolicyRule != cIpAddressPolicyRulesInfo.policyRules.end())
and getting compilation error:
error: no match for 'operator!=' in 'itPolicyRule != cIpAddressPolicyRulesInfo.IPAddressPolicyRulesInfo:olicyRules.std::map<_Key, _Tp, _Compare, _Alloc>::end [with _Key = std::basic_string<char, std::char_traits<char>, std::allocator<char> >, _Tp = PolicyRuleInfo, _Compare = std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, _Alloc = std::allocator<std:air<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >, PolicyRuleInfo> >]()'
Could the c++ experts give some quick advice and help me with this please ?
thanks a lot,
~p
-
November 3rd, 2015, 02:11 PM
#2
Re: Issue in c
map<>::find() returns a map<>::iterator http://en.cppreference.com/w/cpp/container/map/find
so something like:
Code:
listOfPolicyRuleInfo::iterator it = cIpAddressPolicyRulesInfo.policyRules.find(sDedicatedBearerId);
// Check it against policyRules.end()
gg
-
November 3rd, 2015, 02:26 PM
#3
Re: Issue in c
Thanks gg for the reply..
But i,e what i am also doing:
if (itPolicyRule != cIpAddressPolicyRulesInfo.policyRules.end())
and getting the above mentioned compile error
-
November 3rd, 2015, 02:34 PM
#4
Re: Issue in c
Code:
listOfPolicyRuleInfo itPolicyRule = ...
itPolicyRule is the wrong type.
gg
-
November 3rd, 2015, 02:51 PM
#5
Re: Issue in c
yes, i was in hurry and didnt notice this silly mistake..Thanks a lot
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|