#include required to use initializer list in range-based for?

前端 未结 2 1355
眼角桃花
眼角桃花 2021-01-17 11:40

The final C++11 standard includes provisions for range-based for to \"just work\" for native arrays without having to include or any other head

2条回答
  •  不知归路
    2021-01-17 12:27

    GCC 7.1 produces the following error if is not included:

    error: deducing from brace-enclosed initializer list requires #include 
         for (auto i : { 1, 2, 3, 4, 5 })
                                       ^
    

    To see this error one should omit , because including will also include .

提交回复
热议问题