Skip to content
Snippets Groups Projects
Unverified Commit 521985a4 authored by Tobias Leibner's avatar Tobias Leibner
Browse files

[container.vector-interface] add back operator[]

parent b8b94273
No related branches found
No related tags found
No related merge requests found
...@@ -285,6 +285,16 @@ protected: ...@@ -285,6 +285,16 @@ protected:
} }
public: public:
inline ScalarType& operator[](const size_t ii)
{
return get_entry_ref(ii);
}
inline const ScalarType& operator[](const size_t ii) const
{
return get_entry_ref(ii);
}
/// \} /// \}
/// \name These methods override default implementations from VectorInterface. /// \name These methods override default implementations from VectorInterface.
/// \{ /// \{
......
...@@ -136,6 +136,26 @@ public: ...@@ -136,6 +136,26 @@ public:
return true; return true;
} // ... valid() } // ... valid()
/**
* \brief Get writable reference to the iith entry.
* \note \attention The returned reference may be invalid once (any entry of) the vector is changed!
*/
inline ScalarType& operator[](const size_t ii)
{
CHECK_CRTP(this->as_imp()[ii]);
return this->as_imp()[ii];
}
/**
* \brief Get read-only reference to the iith entry.
* \note \attention The returned reference may be invalid once (any entry of) the vector is changed!
*/
inline const ScalarType& operator[](const size_t ii) const
{
CHECK_CRTP(this->as_imp()[ii]);
return this->as_imp()[ii];
}
/** /**
* \brief The dimension of the vector. * \brief The dimension of the vector.
* \return The dimension of the vector. * \return The dimension of the vector.
......
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