#include <iostream>
#include <vector>
using namespace std;
struct D3DXVECTOR3
{
float x,y,z;
};
void _myfunc(D3DXVECTOR3 *arr,int x, int y)
{
for(int i=0;i<x;i++)
{
for(int j=0;j<y;j++)
{
arr[i*y + j].x=i;
arr[i*y + j].y=j;
arr[i*y + j].z=i+j;
}
}
}
template<class T, int x, int y>
void myfunc(T (&arr)[x][y])
{
_myfunc(arr[0],x,y);
}
int main()
{
const int x = 10;
const int y = 20;
D3DXVECTOR3 arr[x][y];
myfunc(arr);
for(int i=0;i<x;i++)
{
for(int j=0;j<y;j++)
{
std::cout<<arr[i][j].x<<" "<<arr[i][j].y<<" "<<arr[i][j].z<<std::endl;
}
std::cout<<std::endl;
}
std::cin.get();
}