C++ template using for what?

//For class using ,you can set a serious of macro to predict something//
//when you call this macro ,the template could make a new function by your input//
template <typename T,int N>
class Array
{
private:
T m_Array[N];
public:
int Getsize() const { return N; }
};
int main()
{
Array<std::string,100> array;
std::cout << array.Getsize() << std::endl;
std::cin.get();
}

 

posted on 2022-11-13 13:39  yangpeiqi  阅读(6)  评论(0编辑  收藏  举报