I want to check if a key (which is a pair itself) is present in the map or not.
I am new to using map and am unable to find a function which will check for a key (which is a pair).
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
typedef pair<ll,ll> my_key_type;
typedef map<my_key_type,ll> my_map_type;
int main()
{
my_map_type ma;
my_map_type::iterator it;
ma.insert(make_pair(my_key_type(30,40),6));
it=ma.find(30,40);
if(it==ma.end())
{
cout<<"not present";
return 0;
}
cout<<"present";
return 0;
}
I received the following error-
no matching function for call to βstd::map<std::pair<long long int, long long int>, long long int>::find(int, int)β it=ma.find(30,40);