Stl pair code explanation

Please provide the code how we will implement this whole code with STL library(Pair).
Thankyou

 pair<int,int> diameter(TreeNode* root)
{
    pair<int,int>p;
    if(root==NULL)
    {
        p.first=0;//height
        p.second=0;//diameter
        return p;
    }
    pair<int,int> left=diameter(root->left);
    pair<int,int> right=diameter(root->right);
    
    p.first=max(left.first,right.first)+1;
    p.second=max(left.first+right.first,max(left.second,right.second));
    return p;
}

The diameter function would be something like this

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.