Hot answers tagged

6 votes
Accepted

RAII POSIX process created by fork

Consider what happens after proc_main() finishes My main hesitation is that the child process ends up in a potentially weird state where the entire thing runs ...
  • 38.3k
5 votes

RAII POSIX process created by fork

Construction and copying I don't think we need to make this class non-moveable, but if we did, it's sufficient to delete just the copy constructor and assignment operator - we won't get compiler-...
  • 63.2k
5 votes

Memento Pattern with abstract base classes and partial restoring only

Unnecessary use of smart pointers There is no need to use std::unique_ptr for LevelMementos. Consider that ...
  • 38.3k
5 votes
Accepted

Growable vector on the stack with fixed capacity

Design The reason for designing and using a fixed-capacity vector is generally efficiency. Forcing debug-iterators down the users throat breaks that. At least, make it opt-in, maybe following MS ...
  • 18.2k
5 votes

Dependency problem with field changes

This is a tough one. I can see what you are trying to achieve, and your solution obviously works, but your own spider senses are already tingling that this is not the ideal solution. So why is that? ...
  • 38.3k
4 votes

Dependency problem with field changes

It's an interesting question, and the code is a little complex but not bad. Here are some things that may help you improve it. Initialize all members The constructor for Person initializes every data ...
  • 64.9k
3 votes
Accepted

Wordle game in C++

Avoid macros Avoid preprocessor macros where possible. They have various issues if you don't use them carefully, and they are rarely needed in C++. To define constants, create ...
  • 38.3k
1 vote

Memento Pattern with abstract base classes and partial restoring only

To add, Unscoped global enum leaks names into the global scope. Make it enum class, probably? ...
  • 338
1 vote

C++11 Threadpool

This is quite nice, there are not many thread pool implementations that actually take care of dealing with the return value of the enqueued tasks. Split off the thread-safe queue into its own class A ...
  • 38.3k
1 vote

myhash - library with hash functions

The first thing that sprung out at me is that you are missing an include guard. You may have simply not posted it, so ignore that if that is the case. First, a word about the API. Generally this is ...
  • 206
1 vote

Entity component system for text-based console on Windows

Unnecessary overhead of NonCopyable Because your NonCopyable has a virtual destructor, it forces any class inheriting from it to ...
  • 38.3k

Only top scored, non community-wiki answers of a minimum length are eligible