Skip to content
Snippets Groups Projects
Commit 5ea802e5 authored by Ansgar Burchardt's avatar Ansgar Burchardt
Browse files

Rename vec_access() and vec_size() methods

This commit renames the `vec_access()` and `vec_size()` methods to match
the ones in the `DenseVector` facade class, that is `operator[]()` and
`size()`.

Closes #3
parent 37181da5
No related branches found
No related tags found
No related merge requests found
......@@ -284,18 +284,18 @@ namespace Dune {
//! random access
value_type & operator[] (size_type i)
{
return asImp().vec_access(i);
return asImp()[i];
}
const value_type & operator[] (size_type i) const
{
return asImp().vec_access(i);
return asImp()[i];
}
//! size method
size_type size() const
{
return asImp().vec_size();
return asImp().size();
}
//! Iterator class for sequential access
......
......@@ -137,9 +137,9 @@ namespace Dune {
}
//==== make this thing a vector
size_type vec_size() const { return _data.size(); }
K & vec_access(size_type i) { return _data[i]; }
const K & vec_access(size_type i) const { return _data[i]; }
size_type size() const { return _data.size(); }
K & operator[](size_type i) { return _data[i]; }
const K & operator[](size_type i) const { return _data[i]; }
};
/** \brief Read a DynamicVector from an input stream
......
......@@ -158,12 +158,10 @@ namespace Dune {
}
using Base::operator=;
DUNE_CONSTEXPR size_type size () const { return vec_size(); }
// make this thing a vector
DUNE_CONSTEXPR size_type vec_size () const { return SIZE; }
K & vec_access(size_type i) { return _data[i]; }
const K & vec_access(size_type i) const { return _data[i]; }
DUNE_CONSTEXPR size_type size () const { return SIZE; }
K & operator[](size_type i) { return _data[i]; }
const K & operator[](size_type i) const { return _data[i]; }
private:
void fill(const K& t)
{
......@@ -266,17 +264,15 @@ namespace Dune {
return *this;
}
DUNE_CONSTEXPR size_type size () const { return vec_size(); }
//===== forward methods to container
DUNE_CONSTEXPR size_type vec_size () const { return 1; }
K & vec_access(size_type i)
DUNE_CONSTEXPR size_type size () const { return 1; }
K & operator[](size_type i)
{
DUNE_UNUSED_PARAMETER(i);
assert(i == 0);
return _data;
}
const K & vec_access(size_type i) const
const K & operator[](size_type i) const
{
DUNE_UNUSED_PARAMETER(i);
assert(i == 0);
......
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