Revision 94aa701f-203e-463c-a409-cfdf9d6be2a6 - Code Review Stack Exchange

1. The namespace `std` is not designed for wholesale importation, see "*[Why is “using namespace std” considered bad practice?](https://stackoverflow.com/questions/1452721/why-is-using-namespace-std-considered-bad-practice)*" for more detail.

 You could instead do a `using std::cout;` or better qualify the three use-sites.

1. You don't in any way encapsulate the list and abstract over the list. It's just a bunch of `Node`s. Consider putting it all into a `List` owning and managing the whole lot.

1. Trying to `remove()` the root-`Node` uncovers a bug. Try to trace it through.

1. `pointer != nullptr` is just a long-winded way to write `pointer` in a boolean context. Respectively for `pointer == nullptr` and `!pointer`. Yes, Java needs that, but this is C++.

1. When you `return` from the `if`-branch, putting the alternative in an `else`-branch is superfluous.

1. A function for printing an object should allow the *caller* to specify the stream, and be called `operator<<`.

1. There is no reason to rely on the compiler transforming recursion to iteration, especially as it might not always be able.

1. `this` should rarely be used explicitly.

AltStyle によって変換されたページ (->オリジナル) /