#Do you think this is an elegant way to write code?

1 messages · Page 1 of 1 (latest)

scenic quartz
#

I just rewrote my engine 2 month ago. I started to use namespaces. Do you know there is a better approach for this ?

honest badger
#

What's the type of logsJson

scenic quartz
#

I store logs in json

#

logs contains :
date
message
where it came from

honest badger
#

nlohmann?

scenic quartz
#

yeah

honest badger
#

ah alright

scenic quartz
#

I already included nlohmann json like you mentioned

honest badger
#

Suggestion

#

move the using json = nlohmann::json inside your namespace

#

Also please always send full formatted code and not screenshots

grand boltBOT
#
How to Format Code on Discord
Markup

```cpp
int main() {}
```

Result
int main() {} ```
scenic quartz
honest badger
scenic quartz
#

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 ?
honest badger
#

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

marble finch
honest badger
#

it won't need to include a, b

marble finch
#

Hmm idk

honest badger