Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 387 Bytes

2.38.md

File metadata and controls

19 lines (13 loc) · 387 Bytes

auto will ignore the top-level const qualifier and reference.

decltype will include top-level const and reference.

Same type

int i;
auto a1 = i;     // int
decltype(i) d1;  // int

Different type

int i, &j = i;
auto a2 = j;     // int
decltype(j) d2;  // int &

const int i;
auto a3 = i;          // int
decltype(i) d3 = 42;  // const int