Generic Lambda | C++14





CODE:


#include <iostream>
#include <complex>
#include <string>
using namespace std;


int main() {
    auto add = [](auto x, auto y) { return x+y; };
    
    int a=1, b=2;
    std::string str1 = "CppNuts", str2="Rupesh";
    
    cout << add(a,b) << endl;
    cout << add(str1,str2) << endl;
    return 0;
}

Post a Comment

0 Comments