类模板中使用重载输出运算符<< VS2019编译器提示无法解析的外部命令
在模板类, 使用重载运算符的时候,编译器无法通过编译
后来问了大牛, 才知道是C++开发者挖的一个坑, 只要在代码里添加<>就完美解决
代码:
#pragma once
#include <iostream>
using namespace std;
//Vector容器类
template <typename T>
class Vector{
public:
Vector(int size = 64); //构造函数
Vector(const Vector& other); //拷贝构造函数
~Vector(); //析构函数
T& operator[](int index); //下标运算符
Vector& operator=(const Vector& other); //赋值运算符
int getLength()