C++ decltype

#include <iostream>

using namespace std;

int main()
{
	int ia{3};
	decltype(ia) varr[3]={1,2,3};
	for(auto&& x:varr)
		cout << x << endl;
	return 0;
}

在这个例子中,数组varr中元素的类型即变量ia的类型。

posted @ 2019-12-25 03:53  2021年的顺遂平安君  阅读(158)  评论(0编辑  收藏  举报