Hot answers tagged

10

Header The header file includes a couple of headers that it doesn't need: #include <fstream> #include <iostream> That said, I would consider including <iosfwd> and declaring functions that work on streams (probably using >> and <<) rather than files, to make unit-testing possible. It also has using namespace std;, which is ...


5

Don't overuse std::vector You are using std::vector for many things that shouldn't be vectors. For example, storing a single vertex should be done in a struct that holds the x, y and z coordinates: struct dvec3 { double x; double y; double z; }; I named it dvec3 because it is a vector (in the mathematical sense) of 3 doubles, and it follows the ...


4

Sorry it took so long—this is a very busy time of year for me (and it’s getting worse)—but as promised, here is an error-handling-focused review. This review is laser-focused just on the error-handling in the original code; other reviews do a fine job of covering other angles. The main focus is going to be error-handling with IOstreams, but I’ll brush on ...


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