auto in c++ with initializer_list

187 Views Asked by At

the question about effective modern c++ item 2:

auto x3={27};// x3's type is std::initializer_list
auto x4{27}; // x4's type is std::initializer_list

but when I test x4's type , I found the type of x4 is int

I don't know what type of x4

#include<iostream>
#include<typeinfo>
using namespace std;

int main()
{
    auto x4{ 27 };
    cout << typeid(x4).name();
}

enter image description here

thanks for every one, I have known the answer.

0

There are 0 best solutions below