I have a map like this
map<int,pair<int,int>>diff;
I am using it like this
int temp;
    for(int i=0;i<n-1;i++)
    {
        for(int j=i+1;j<n;j++)
        {
            temp=v[j]-v[i];
            if(temp>0)
            {
                if(diff.find(temp)!=diff.end())
                {
                    pair<int,int> a=diff.find(temp);
                    if(a.second>j)
                    {
                        a.second=j;
                        a.first=i;
                    }
                }
                else
                {
                    map.insert({temp,{i,j}});
                }
            }
        }
    }    
where n is the size of vector v.
The error I am getting is
error: conversion from ‘std::map<int, std::pair<int, int> >::iterator {aka std::_Rb_tree_iterator<std::pair<const int, std::pair<int, int> > >}’ to non-scalar type ‘std::pair<int, int>’ requested
pair<int,int> a=diff.find(temp);
I looked online and I found that if element exists then map.find() returns to the position of element in the vector so in this it should return the pair to the element right?
What am I doing wrong?
 
    