I have a three library classes each in separate file's:
File S.h:
#pragma once
#include "A.h"
class S
{
A<int> a;
};
File: A.h:
#pragma once
#include "S.h"
#include "E.h"
template<typename T>
class A
{
public:
template<int N>
void foo()
{
E c;
}
};
File E.h:
#pragma once
#include "S.h"
class E
{
public:
S m_s;
};
When user write a code like this:
//#include "A.h"
#include "S.h"
#include "E.h"
int main()
{
S s;
E c;
c.m_s = s;
}
It gets an error like: 'm_s': unknown override specifier.
Because of the after preprocessing class S; the definition appears below the class E; (which is use class S as the class member)
If I uncomment the first include, the problem will be slowed but for me, it's not a good solution. Another way is it's a hidden member of class E in something like PImpl, but it's not possible also due to some reasons.
Is there exist another solution for this problem?