summaryrefslogtreecommitdiff
path: root/2p38.cpp
blob: 1b80fe97c89a3ab816bb68e02dbfd0d7c9f601f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <iostream>

/*
 *
 * 2.38
 * auto ignores toplevel const and reference
 * decltype included toplevel const and reference
 */

int main () {

	int i = 109; //int
	int *pi = &i; //int*
	const int ff = 1; // const int

	auto ffi = ff; //int
	decltype(ff) ffd = 100; //const int
	auto ai = *pi; // int
	decltype(*pi) di = i; //int&
	
	std::cout << ai << " " // 109
			  << di << " " // 109
			  << ffi << " " // 1
			  << ffd << " " // 100
			  << std::endl;
	return 0;
}