Teach ArrayRefWithPadding to make a const flavour
commit478771d6d79641c2ab056dadea7aea84d2f1f013
authorMark Abraham <mark.j.abraham@gmail.com>
Wed, 15 May 2019 10:21:30 +0000 (15 12:21 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Thu, 23 May 2019 20:30:56 +0000 (23 22:30 +0200)
tree1febb8b0979cfaae9c37377bf3f0f7f15ba51613
parent916efac11657dfbe8242a2098608b4dede9728d6
Teach ArrayRefWithPadding to make a const flavour

Sometimes code that has a non-const view of padded memory needs to be
able to have a const view of that memory, e.g. to pass to a routine
that does not need to be able to modify. Now there is a member
function to do that. Note that the private data means that it is not
easy to construct the const view from the non-const view, because they
are different instantiations of the same template, so formally are
different types. However there is now a convenience overloaded
constructor so that passing a non-const view to a function that takes
a const view will work.

Also fixed the swap member, which fortunately was unused.

Change-Id: I52095fe3b5d5dd24b86698da2a065c0fd1f3fb0b
src/gromacs/math/arrayrefwithpadding.h
src/gromacs/math/tests/arrayrefwithpadding.cpp