blob: d0bf7e28e50e836c0e45cc6a553601f6649b7a18 (
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
|
#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
std::cout << dti << " " // Will print 101
<< dtii << " " // Will print 101
<< dtii2 << " " // Will print 102
<< dtiii << " " // Will print 100
<< dtiii2 << " " << std::endl; // Will print 100
return 0;
}
|