Skip to content

Commit

Permalink
span: rename Access -> operator[]
Browse files Browse the repository at this point in the history
because that's what it does
  • Loading branch information
germasch committed Mar 26, 2019
1 parent 16c9056 commit a969bd2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bindings/CXX11/cxx11/Variable.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,14 @@ const T &Span<T>::at(const size_t position) const
template <class T>
T &Span<T>::operator[](const size_t position)
{
IOType &data = m_Span->Access(position);
IOType &data = (*m_Span)[position];
return reinterpret_cast<T &>(data);
}

template <class T>
const T &Span<T>::operator[](const size_t position) const
{
const IOType &data = m_Span->Access(position);
const IOType &data = (*m_Span)[position];
return reinterpret_cast<const T &>(data);
}

Expand Down
4 changes: 2 additions & 2 deletions source/adios2/core/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class Span
T &At(const size_t position);
const T &At(const size_t position) const;

T &Access(const size_t position);
const T &Access(const size_t position) const;
T &operator[](const size_t position);
const T &operator[](const size_t position) const;

private:
Engine &m_Engine;
Expand Down
8 changes: 4 additions & 4 deletions source/adios2/core/Variable.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ T &Span<T>::At(const size_t position)
" , in call to T& Span<T>::At\n");
}

return Access(position);
return (*this)[position];
}

template <class T>
Expand All @@ -267,18 +267,18 @@ const T &Span<T>::At(const size_t position) const
" , in call to const T& Span<T>::At\n");
}

return Access(position);
return (*this)[position];
}

template <class T>
T &Span<T>::Access(const size_t position)
T &Span<T>::operator[](const size_t position)
{
T &data = *m_Engine.BufferData<T>(m_PayloadPosition + position * sizeof(T));
return data;
}

template <class T>
const T &Span<T>::Access(const size_t position) const
const T &Span<T>::operator[](const size_t position) const
{
const T &data =
*m_Engine.BufferData<T>(m_PayloadPosition + position * sizeof(T));
Expand Down

0 comments on commit a969bd2

Please sign in to comment.