私の問題に対する答えは、以前に作成したスレッドの 1 つにあると確信しています。特に、"template" と "typename" キーワードをどこに、なぜ入れなければならないのでしょうか? テンプレート/タイプ名の明確化に関する優れた説明があります。ただし、相互に対話するクラステンプレートであるコードに概念を実際に拡張できないため、途方に暮れています。
このスレッドでは、コードで発生したのと同じエラーが表示されると思います。T が実際に必要な typename テンプレートであるのA<B>
に対し、B がクラスである場所を使用して typedef を定義するのはなぜですか。A<T>
それにもかかわらず、私はこれらのオプションを試してみましたが、役に立ちませんでした。これがコードです。ご協力ありがとうございました。
#include "testTemplateA.h"
template<typename A>
class testTemplateB {
public:
// none of these work
typedef testTemplateA<A> templateType;
typedef typename testTemplateA<A> templateType;
typedef typename testTemplateA<testTemplateB> templateType;
testTemplateB(templateType& TA) {}
~testTemplateB(void) {}
};
#include "testTemplateB.h"
template<typename A>
class testTemplateA
{
public:
testTemplateA(void) {}
~testTemplateA(void) {}
void callUponB(void) {
testTemplateB<A> g = testTemplateB<A>(this);
}
};