Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 388 Bytes

File metadata and controls

24 lines (18 loc) · 388 Bytes

auto vs decltype

Back{: .button}

int x;
const int& crx = x;

typedef decltype(x) type_x;
// Type is int
type_x a1 = 10;
// Type is int
auto a2 = x;

typedef decltype(crx) type_crx;
// Type is const int&
type_crx b1 = 10;
// Type is int
auto b2 = crx

Reference