美文网首页程序员
【c++11关键字】 auto 未完待续

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

作者: 小鱼号的代码日记 | 来源:发表于2020-10-18 16:02 被阅读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();
}

相关文章

  • C++11中auto和decltype

    C++11中auto和decltype auto和decltype都是C++11中引进来用于自动推断类型的关键字,...

  • C++11拾穗

    C++11新关键字 alignas:指定对齐大小 alignof:获取对齐大小 decltype auto(重新定...

  • 阿里巴巴面试题基础篇 C++11

    ● 请问C++11有哪些新特性? 参考回答: C++11 最常用的新特性如下: auto关键字:编译器可以根据初始...

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

  • 关键字 Auto

    Auto 关键字作用 在阅读了《深入应用C++11 代码优化与工程级应用》的第一张第一节之后,对auto关键字的认...

  • C++11/14/17新特性

    C++11/14/17常用特性 关键字 auto 让编译器根据上下文情况,确定auto变量的真正类型,可以作为函数...

  • C++11:auto

    auto这个关键字在C++11之前就存在的,只不过当时它的含义是指明对象的存储期。这个用途在C++11中已经删除了...

  • c++ 11~20 新特性速查

    持续更新中。。。 c++11 std::auto (c++11) raw string (c++11) std::...

  • C++11的类型推导详解

    auto & decltype 关于C++11新特性,最先提到的肯定是类型推导,C++11引入了auto和decl...

  • C++11类型推导

    C++11 重新定义了auto 和 decltype 这两个关键字实现了类型推导,让编译器来操心变量的类型。 au...

网友评论

    本文标题:【c++11关键字】 auto 未完待续

    本文链接:https://www.haomeiwen.com/subject/trcqmktx.html