Skip to content
Snippets Groups Projects
Commit 1ad99477 authored by Oliver Sander's avatar Oliver Sander
Browse files

Add new method 'size' to class MultiTypeBlockVector, which returns the vector size

The class already contains a method 'count', which returns the same value.
However, all our other vector types use 'size' for the vector size, not
'count'.

Additionally, the method is static and DUNE_CONSTEXPR, which is sometimes
helpful.
parent 02dbc9e4
No related branches found
No related tags found
No related merge requests found
......@@ -256,6 +256,12 @@ namespace Dune {
typedef typename T1::field_type field_type;
/** \brief Return the number of vector entries */
static DUNE_CONSTEXPR std::size_t size()
{
return mpl::size<type>::value;
}
/**
* number of elements
*/
......
......@@ -37,6 +37,9 @@ int main(int argc, char** argv) try
// test method 'count'
std::cout << "multi vector has " << multiVector.count() << " first level blocks" << std::endl;
static_assert(multiVector.size()==2, "Method MultiTypeBlockVector::size() returned wrong value!");
if (multiVector.count() != 2)
DUNE_THROW(Exception, "Method MultiTypeBlockVector::count returned wrong value!");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment