次のように前方宣言を使用するのは好きではありません。
struct A;
struct B
{
A* a;
}
// Implementation
私は次のようなことをする習慣があります:
struct B
{
struct A* a;
}
しかし、テンプレート クラスでそれを実行しようとすると問題が発生します。
template<typename T>
struct A
{
struct B<T>* _t;
};
template<typename T>
struct B
{
T _t;
};
そして、コンパイラは私に言います:
test.cpp:4:12: error: 'B' is not a template
test.cpp:8:8: error: 'B' is not a template type
どうすればこれを達成できますか?