程序员

【c++11关键字】 auto 未完待续

2020-10-18  本文已影响0人  小鱼号的代码日记
/*
 * c++11关键字
 * auto
 *  未完待续
 * 小鱼号的代码日志
*/
#include <QCoreApplication>
#include <iostream>
#include <typeinfo>
using namespace  std;
float add(int a,float b)
{
    return a+b;
}
int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    auto v = 1 + 2;
    cout << " type of v " << typeid(v).name() << "\n";
    auto b = add(11,125.51);
    cout << " type of b " << typeid(b).name() << "\n";
    auto c = {1,2};
    cout << " type of c " << typeid(c).name() << "\n";

    auto myLambda = [](int x) {return x+3;};
    cout << " type of myLambda " << typeid(myLambda).name() << "\n";

    return a.exec();
}
上一篇 下一篇

猜你喜欢

热点阅读