STYLE: add data/cdata to VectorSpace for consistency with FixedList etc

This commit is contained in:
Mark Olesen
2019-08-06 12:00:56 +02:00
committed by Andrew Heather
parent c28d785a73
commit 0cfd019b92
3 changed files with 41 additions and 1 deletions

View File

@ -87,6 +87,25 @@ void testIterator(const VecSpace& vs)
}
template<class VecSpace>
void testData(const VecSpace& vs)
{
Info<< "size: " << vs.size() << " for:";
const auto* data = vs.cdata();
for
(
const auto* endData = data + VecSpace::nComponents;
data != endData;
++data
)
{
Info<< " " << *data;
}
Info<< nl;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
@ -105,6 +124,7 @@ int main(int argc, char *argv[])
testIterator(vec1);
testIterator(vec2);
testData(vec2);
// Use STL algorithm(s)