Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

variable type during list initialization using auto

Does using auto for list initialization of variables uses correct type? For example,

#include <iostream>
#include <typeinfo>

int main()
{
  auto v1 = {13};
  auto v2 = 14;

  std::cout<<typeid(v1).name()<<std::endl;
  std::cout<<typeid(v2).name()<<std::endl;
  return 0;
}

Output is :

St16initializer_listIiE
i

Question: Why v1 is list?

Comments