#include <iostream>
usingnamespace std;
template <typename T>
struct AT
{
T* p;
...
};
template <typename T>
struct BT
{
T* p;
...
};
int main() {
using B = BT<A>;
using A = AT<B>;
AT<B> a;
BT<A> b;
return 0;
}
This code fails to compile with the following error with gcc:
source>:21:18: error: 'A' was not declared in this scope; did you mean 'AT'?
21 | using B = BT<A>;
I am not sure how I should declare a template based on the other one. Is there a solution to this compilation error or a better solution to my bidirectional association desing?