智能指针

太长了

Auto

 

 

auto和其他变量类型有明显的区别:

 

1.auto声明的变量必须要初始化,否则编译器不能判断变量的类型。

 

2.auto不能被声明为返回值,auto不能作为形参,auto不能被修饰为模板参数

#include<iostream>
auto show(int m)->decltype(1.0){return m;}
auto show()->decltype(1l){return 11;}
int main()
{
    std::cout<< show(10) << std::endl;
    long (*a)() = show;
    //int (*b)() = show;
    std::cout<<a()<<std::endl;
    std::cout<<b()<<std::endl;
    return 0;
}

 

 

 

参考链接:

【1】https://www.jianshu.com/p/a462a35c9481

【2】https://blog.csdn.net/k346k346/article/details/81478223

【3】https://blog.csdn.net/flowing_wind/article/details/81301001

【4】我喜欢这个https://blog.csdn.net/weizhengbo/article/details/68957993

【5】autohttps://blog.csdn.net/qq_31930499/article/details/79948906

【6】autohttps://blog.csdn.net/rubikchen/article/details/89918876

相关文章:

  • 2021-03-31
  • 2021-12-03
  • 2021-04-17
  • 2021-12-04
  • 2021-07-08
  • 2021-11-28
  • 2022-02-09
  • 2019-08-30
猜你喜欢
  • 2022-12-23
  • 2021-11-28
  • 2021-06-01
  • 2021-08-20
  • 2021-07-14
  • 2021-02-04
相关资源
相似解决方案