Using multidimensional std::initializer_list

流过昼夜 提交于 2019-12-04 09:53:00
Nawaz

Yes, as the error message says, you need to write typename here:

typename std::vector<std::initializer_list<T>>::iterator i = setVec.begin();

It is because iterator is a dependent name. Read this for detail explanation:

If your compiler supports auto introduced by C++11, then you could write this:

auto i = setVec.begin();

which is much better syntax. Since you're already using C++11 feature such as std::initializer_list, you should start using auto wherever it makes your life easy.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!