blob: e18fd0add7264f61908c99d12af08fdcbb766c7d (
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
28
29
30
31
32
|
#include <iostream>
#include "sales_item.hpp"
/*
*
* decltype testing
*
*
*/
int main () {
int i = 100;
int &ii = i;
int *iii = &i;
decltype(i) dti = 101; //int
decltype(ii) dtii = dti; //int&
decltype(ii + 0) dtii2 = 102; //int
decltype(*iii) dtiii = i; //int&
decltype(*iii + 0) dtiii2 = i; //int
decltype(iii) dtiii3 = &i; //int*
std::cout << dti << " " // Will print 101
<< dtii << " " // Will print 101
<< dtii2 << " " // Will print 102
<< dtiii << " " // Will print 100
<< dtiii2 << " " // Will print 100
<< dtiii3 << " " // Address if i
<< &i << " " // address of i
<< std::endl;
return 0;
}
|