decltypetypename-創(chuàng)新互聯(lián)

decl

我們提供的服務(wù)有:網(wǎng)站設(shè)計制作、網(wǎng)站設(shè)計、微信公眾號開發(fā)、網(wǎng)站優(yōu)化、網(wǎng)站認證、海南ssl等。為上千家企事業(yè)單位解決了網(wǎng)站和推廣的問題。提供周到的售前咨詢和貼心的售后服務(wù),是有科學(xué)管理、有技術(shù)的海南網(wǎng)站制作公司type((variable))總是引用類型,但是decltype(variable)只有當(dāng)variable是引用類型時才是引用類型。decltypetypename
#include <iostream>
#include<typeinfo>

using std::cin;
using std::cout;
using std::endl;

auto f(auto x)
{return x+1;}
auto f(auto x,auto y)->decltype(y){
return x-y;
}
 
double func()
{
    cout<< "func executed." << endl;
return 2.5+3.6;
}

int main()
{
    decltype(func()) sum;
    cout<< typeid(sum).name() << endl;
    
const int ci = 0, &cj = ci;
    decltype(ci) x= 0;
    decltype(cj) y= x;
//decltype(cj) z;// compile error: ‘z’ declared as reference but not initialized    cout << typeid(x).name() << endl;
    cout<< typeid(y).name() << endl;
    
int i = 10, *p = &i, &r = i;
    decltype(r+ 0) b;
//decltype(*p) c;// compile error: ‘c’ declared as reference but not initialized    cout << typeid(b).name() << endl;
    
    decltype(i) u;
//decltype((i)) v;// compile error: ‘v’ declared as reference but not initialized    
  return 0;
}

新聞名稱:decltypetypename-創(chuàng)新互聯(lián)
標題鏈接:http://muchs.cn/article24/diesje.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站策劃、用戶體驗電子商務(wù)、動態(tài)網(wǎng)站、App開發(fā)、網(wǎng)頁設(shè)計公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

營銷型網(wǎng)站建設(shè)