We had a look at the code. Looks great!
I left some comments on bitbucket.
In addition to the bitbucket comments, I think that "new" and "delete" should be
replaced by uses of "unique_ptr" in both PerStateInformation and PerStateArray,
unless there is a reason not to.
When comparing PerStateInformation and PerStateArray, some "clean-ups" in
PerStateArray have been carried over to PerStateInformation (e.g. using auto in
one place, using "= delete", using nullptr), but others have only been applied
to PerStateInformation (e.g. "using" instead of "typedef" and a range-based for
loop). I think it would valuable to migrate these changes over to
PerStateInformation because the two classes will be easier to maintain if they
stay more similar.
For the same reason of keeping the two files more similar, I wonder if we should
not move ArrayView to its own file, but I won't insist on this.
I see that we did not implement const look-up for PerStateArray. I understand
why (it would have required implementing a ConstArrayView?), but of course it is
a bit unfortunate to have this difference in interface between
PerStateInformation and PerStateArray. If people try to use the non-existing
method, it would be good if they could get a helpful message that tells them
what needs to be done. How about implementing the method, but making it just do
ABORT("PerStateArray::operator[] const not implemented. "
"See source code for more information.");
And then in the source code just below the ABORT a comment like:
/*
This method is not implemented because it is currently not used and
would require quite a bit of boilerplate, introducing a ConstArrayView
class similar to ArrayView. If you need it, it should be easy to
implement based on PerStateInformation:operator[] const.
*/
It would be nicer to have the (run-time) ABORT be a compile-time error instead
if the method is used, but I don't know how to do that.
|