How to pass a VLA to a function template?

后端 未结 6 1883
温柔的废话
温柔的废话 2020-12-12 05:00

I have the following code which could not be complied.

using namespace std;
void f(int);
template
void array_ini_1d(T1 (&x)[         


        
6条回答
  •  粉色の甜心
    2020-12-12 05:36

    template
    void f(T* a)
    {
    /* add your code here */
    }
    
    int main()
    {
        int a[10];
        f(a);
        return 0;
    }
    

提交回复
热议问题