私の質問はこれに少し関連しています。
一部のクラスの演算子 << をオーバーロードしたいのですが、両方が機能する2つの異なる表記法を見つけました。
template <class T>
class A{
T t;
public:
A(T init) : t(init){}
friend ostream& operator<< <> (ostream &os, const A<T> &a); //need forward declaration
//template <class U> friend ostream& operator<< (ostream &os, const A<U> &a);
};
同じものを異なる表記法で定義していますか? または、最初のバージョンは、<< のどのインスタンス (この場合、私のクラス A と同じ T を持つインスタンスのみ) が A のフレンドであるかにより制限的ですか?