‘{{0, 1}, {0, -1}, {1, 0}, {-1, 0}}’
for(auto [dx,dy]: {{0,1},{0,-1},{1,0},{-1,0}}){
^
Clang => error: cannot use type 'void' as a range
for(auto [dx,dy]: {{0,1},{0,-1},{1,0},{-1,0}}){
^
Is there a way to make this work? While I can make vector above and iterate over it, I am a little confused why I can't do like this
Because type-deduction cannot extract which type you want to use. std::array, std::vector, list? So, it cannot be known by compiler.
You can't
Обсуждают сегодня