#Do you think this is an elegant way to write code?
1 messages · Page 1 of 1 (latest)
What's the type of logsJson
nlohmann?
yeah
ah alright
I already included nlohmann json like you mentioned
Suggestion
move the using json = nlohmann::json inside your namespace
Also please always send full formatted code and not screenshots
```cpp
int main() {}
```
int main() {} ```
Can it cause compiler problems if I use it outside of the namespace?
No
But having it be a global typedef will mess with whoever's using your code
also I am curious. When I include files each other like :
a.cpp
#include "b.hpp"```
b.cpp
```cpp
#include "a.hpp"```
this approach causes compiler errors. how can I get away from it ?
Instead of this
implement a c.hpp header
where what a, b need are in that c.hpp file
and so both a.hpp and b.hpp include c.hpp
but c does not include any of these
Wouldn't that double include c in case a & b are needed ?
If the functions both a,b are using is in c, no
it won't need to include a, b
Hmm idk
If they need the class names iirc they could do