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

Use 'const_reference' instead of 'const value_type&' to refer to const references to vector entries

This fixes a valgrind warning in the test for VariableBlockVector, where the reference type
is an internal proxy class.
parent 57141a3a
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,12 @@ namespace Dune
static_assert(std::is_same<typename Vector::block_type, typename Vector::value_type>::value,
"'block_type' is not equal to 'value_type'");
// Check whether 'reference' and 'const_reference' are properly exported
static_assert(std::is_same<typename Vector::reference, typename Vector::reference>::value,
"Vector does not export 'reference'");
static_assert(std::is_same<typename Vector::const_reference, typename Vector::const_reference>::value,
"Vector does not export 'const_reference'");
// class allocator_type
#if 0 // Out-commented, because it is not clear whether vectors with static allocation should have this
static_assert(std::is_same<typename Vector::allocator_type, typename Vector::allocator_type>::value,
......@@ -55,10 +61,9 @@ namespace Dune
// - is random-access iterator
Vector vMutable = v;
auto noop = [](const typename Vector::value_type& t){};
auto noop = [](typename Vector::const_reference t){};
// This is testing the non-const iterators
testRandomAccessIterator(vMutable.begin(), vMutable.end(), noop);
// ConstIterator / const_iterator
static_assert(std::is_same<typename Vector::ConstIterator, typename Vector::ConstIterator>::value,
"Vector does not export 'ConstIterator'");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment