Super short c++


#1
std::function<int(int,int)> getop(const string& v)
{
        if(v.size()!=1)
            return nullptr;
            switch(v[0])
        {
            case '*': return [](int num1 ,int num2 )->int{return num1*num2;};
            case '/': return [](int num1 ,int num2 )->int{return num1/num2;};
            case '+': return [](int num1 ,int num2 )->int{return num1+num2;};
            case '-': return [](int num1 ,int num2 )->int{return num1-num2;};
            default: return nullptr;
        }
    
}
int Solution::evalRPN(vector<string> &A)
{
    string v = A.back();A.pop_back();
    auto op = getop(v);
    return op? op(evalRPN(A),evalRPN(A)):atoi(v.c_str());
}