Hot answers tagged

7

Ephemeris::Ephemeris() { } No need for a constructor if it does nothing. Ephemeris::~Ephemeris() { if (telnet != nullptr) delete telnet; } The test here is pointless, since delete works fine with a null argument. We can improve on this by making telnet a smart pointer (probably std::unique_ptr<TelnetClient>), so that a default ...


5

X(); Since we specify a value constructor, the compiler won't generate the default constructor. So we don't need to declare it private to prevent its use. The move operators can declared = default: X(X&& moveFrom) = default; X& operator=(X&& moveFrom) = default; You actually appear to have two copy assignment operators instead ...


4

I agree with everything Toby Speight wrote. I'd like to add: Name things according to what they represent You have this line of code: tcp::resolver::iterator iterator = resolver.resolve(query); But while iterator is indeed an iterator, that's not what is important about this variable. What really is important is that it is the result of the DNS query. So I ...


3

Review The code is well formatted and also reasonably well implemented, lacking only a few security overhauls such as memory leaks and optimizations also completing the pending implementations of existing concepts in unique_ptr Is it well-formed? Yes, have good formatting i.e. does it follow common C++ standard and patterns (for example, should private ...


1

If you just started learning C++, I suggest reading through (and bookmarking) the C++ Core Guidelines. One example that pops out, from your opening remarks, is C.149, R.11, and P.9. That is, rather than being puzzled as to where to put the delete[] statements due to exception handling, you should not be writing explicit calls to delete in your code. #...


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