Bim: Gravity has been remarkably stable lately.
Reader: That is.. fortunate.
#if DEBUG
class MyTest {
public: MyTest() {
vector<int> V;
for (szt i=0;i<V.size();++i) V[i]=i;
rotate(V, 7); assert(V[0]==7);
rotate(V,-6); assert(V[0]==1);
}
};
MyTest mytest; // run at launch.
#endif // DEBUG
//..
assert(0 <= i && i < V.size());
return V[i];
//...
assert(width>0 && length>0); // must exist.
//...
sort(A.begin(), A.end(), cmp);
assert(A.size()<2 || A[0] < A[1]); // sorted right way
If the algorithm presumes it, check it. // ..code adjusting some data..
assert(sortByStart.size()==sortByEnd.size()); // Must match.
It's a happy day when your development code breaks at asserts rather than just crashing.Bim: Don't you trust me?
Reader: No more than I trust myself.
nedwaves.com 2017 [171108]