I'm practicing a template example. Here's the code:
//template_practice.h
#pragma once
template<typename T, unsigned N>
void print_arry(ostream &out,const T (&arry)[N])
{
for (T* i = cbegin(arry); i != cend(arry); i++)
{
out << *i << " ";
}
out << endl;
}
//main.cpp
#include "stdafx.h"
using namespace std;
int main()
{
int test[10] = { 1,2,3,4,5,6,7,8,9,10 };
print_arry<int, 10> (cout, test);
getchar();
return 0;
}
//stdafx.h
//... (library headers)
#include "template_practice.h"
There are many errors, including: "header stop not at file scope. And IntelliSense PCH file was not generated","'ostream': undeclared identifier", "expression preceding parentheses of apparent call must have function type"...