【c++11】范畴for语句输出一个二维数组

【c++11】范围for语句输出一个二维数组
printArryV1函数接收一个二维数组,然后使用范围for语句将其输出

void printArryV1(int ai[][4]){
for (auto &row : ai){
for (auto col : row){
cout << col;
}
}
}

在vs2013报错:for (auto &row : ai)【c++11】范畴for语句输出一个二维数组
main函数:

void main(){
int a[][4] = { { 1, 2, 2, 1 }, {1,1,1,1} };
       printArryV1(a);
}

------解决思路----------------------
http://en.cppreference.com/w/cpp/language/range-for说:

range_expression - any expression that represents a suitable sequence (either an array or an object for which begin and end member functions or free functions are defined, see below) or a braced-init-list.
------解决思路----------------------
语法问题  void printArryV1(int (&a)[2][4])
------解决思路----------------------
试试
#include <iostream>

template<typename T>
void printArryV1(T& mtx) {
    for (auto& row : mtx) {
        for (auto col : row){
            std::cout << col << " ";
        }
        std::cout << std::endl;
    }
}

int main(int argc, char * argv[]) {
    int arr[][4]  = { { 1, 2, 2, 1 }, {1,1,1,1} };
    printArryV1(arr);
    
    return 0;
}



------解决思路----------------------
=====================================================================
以下主要参考 c++ primer Page105, 
所以2楼说是语法问题,我想换成值拷贝传递参数也能编译通过, 但是clang编译错误如下:

mic@mac ~/work/dashen$ c++ foo.cpp -std=c++0x
foo.cpp:4:22: error: cannot build range expression with array function parameter 'mtx' since parameter with array type 'int [2][4]' is treated as pointer type 'int (*)[4]'
    for (auto &row : mtx) {
                     ^~~
foo.cpp:3:22: note: declared here
void printArryV1(int mtx[2][4]) {
                     ^
1 error generated.

看到mtx初始化为pointer类型。

重点看Page195:数组传递参数方式:1.数组引用行参,2.指向数组首元素的指针

=====================================================================