Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | Public Types | Public Member Functions
gmx::accessor_basic< ElementType > Class Template Reference

#include <gromacs/mdspan/accessor_policy.h>

Description

template<class ElementType>
class gmx::accessor_basic< ElementType >

The most basic memory access model for mdspan.

Template Parameters
ElementTypethe type held in memory to be accessed

Public Types

using element_type = ElementType
 Type of element to be accessed.
 
using pointer = ElementType *
 Pointer to element to be accessed.
 
using offset_policy = accessor_basic
 How to determine a memory offset, provided by self accessor.
 
using reference = ElementType &
 Type of references.
 

Public Member Functions

constexpr offset_policy::pointer offset (pointer p, ptrdiff_t i) const noexcept
 Shift a pointer by an offset. More...
 
constexpr reference access (pointer p, ptrdiff_t i) const noexcept
 Access element from an offset to given pointer. More...
 
constexpr ElementType * decay (pointer p) const noexcept
 Decay pointer to pointer to ElementType. NOTE This function does nothing, because it is the trivial implementation of an accessor. More...
 

Member Function Documentation

template<class ElementType>
constexpr reference gmx::accessor_basic< ElementType >::access ( pointer  p,
ptrdiff_t  i 
) const
inlinenoexcept

Access element from an offset to given pointer.

Parameters
[in]pPointer to reference memory location.
[in]ioffset from memory location.
Returns
reference to element stored at offset from memory location.
template<class ElementType>
constexpr ElementType* gmx::accessor_basic< ElementType >::decay ( pointer  p) const
inlinenoexcept

Decay pointer to pointer to ElementType. NOTE This function does nothing, because it is the trivial implementation of an accessor.

Returns
input pointer as pointer to ElementType
template<class ElementType>
constexpr offset_policy::pointer gmx::accessor_basic< ElementType >::offset ( pointer  p,
ptrdiff_t  i 
) const
inlinenoexcept

Shift a pointer by an offset.

Parameters
[in]pPointer to reference memory location.
[in]ioffset from memory location.
Returns
pointer to offset memory location.

The documentation for this class was generated from the following file: