Last active
October 20, 2018 11:03
-
-
Save carmel4a/6de051e6bdd5ff4475d0d834b9039cd7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** a.h */ | |
#include "f_decl.h" // here're forward declrs | |
#include "b.h" // needed for `Aa` member. Can't be incomplete type. | |
namespace A | |
{ | |
const int a = 10; | |
const int b = 200; | |
class Aa | |
{ | |
Bb b; // must have definition | |
}; | |
} | |
/** b.h */ | |
#include "f_decl.h" | |
// #include "a.h" include that doesn't solve issue | |
namespace B | |
{ | |
class Bb | |
{ | |
std::array< int, A::a > b_member; // error, compler doesn't see `a` and/or `b` in `A` namespace | |
auto foo() -> void; | |
}; | |
} | |
/** b.cpp */ | |
#include "b.h" | |
#include "f_decl.h" | |
auto B::Bb::foo() -> void | |
{ | |
A::a; // compile error | |
B::b; // compile error | |
} | |
/** f_decl.h */ | |
// some stuff like `class foo; struct foo1;` etc. | |
namespace A | |
{ | |
extern const int a; // ? | |
extern const int b; // ? | |
class Aa; | |
} | |
namespace B | |
{ | |
class Bb; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment