Mundy: Multibody Nonlocal Dynamics Version of the Day
Loading...
Searching...
No Matches
mundy::ShiftedView< T, shift, Accessor > Class Template Reference

Get a shifted accessor into a contiguous accessor. More...

#include <ShiftedView.hpp>

Public Member Functions

constexpr ShiftedView (const Accessor &accessor)
 Constructor from a given accessor.
constexpr ShiftedView (Accessor &&accessor)
 Constructor from a given accessor.
constexpr ShiftedView (const ShiftedView< T, shift, Accessor > &other)
 Shallow copy constructor.
constexpr ShiftedView (ShiftedView< T, shift, Accessor > &&other)
 Shallow move constructor.
constexpr decltype(auto) operator[] (size_t idx)
 Element access operator.
constexpr decltype(auto) operator[] (size_t idx) const
 Element access operator.

Public Attributes

storage< Accessor > accessor_

Detailed Description

template<typename T, size_t shift, ValidAccessor< T > Accessor>
class mundy::ShiftedView< T, shift, Accessor >

Concept: Sometimes we'd like to access a contiguous accessor (with only a [] operator) but with a shift. That is, instead of calling accessor[i], we'd like to call accessor[i + shift]. This class provides a way to do that.

Template Parameters
TThe type of the elements
shiftThe shift in the accessor
AccessorThe type of the contiguous accessor

Constructor & Destructor Documentation

◆ ShiftedView() [1/4]

template<typename T, size_t shift, ValidAccessor< T > Accessor>
mundy::ShiftedView< T, shift, Accessor >::ShiftedView ( const Accessor & accessor)
inlineexplicitconstexpr

◆ ShiftedView() [2/4]

template<typename T, size_t shift, ValidAccessor< T > Accessor>
mundy::ShiftedView< T, shift, Accessor >::ShiftedView ( Accessor && accessor)
inlineexplicitconstexpr

◆ ShiftedView() [3/4]

template<typename T, size_t shift, ValidAccessor< T > Accessor>
mundy::ShiftedView< T, shift, Accessor >::ShiftedView ( const ShiftedView< T, shift, Accessor > & other)
inlineconstexpr

◆ ShiftedView() [4/4]

template<typename T, size_t shift, ValidAccessor< T > Accessor>
mundy::ShiftedView< T, shift, Accessor >::ShiftedView ( ShiftedView< T, shift, Accessor > && other)
inlineconstexpr

Member Function Documentation

◆ operator[]() [1/2]

template<typename T, size_t shift, ValidAccessor< T > Accessor>
decltype(auto) mundy::ShiftedView< T, shift, Accessor >::operator[] ( size_t idx)
inlineconstexpr
Parameters
[in]idxThe index of the element.

◆ operator[]() [2/2]

template<typename T, size_t shift, ValidAccessor< T > Accessor>
decltype(auto) mundy::ShiftedView< T, shift, Accessor >::operator[] ( size_t idx) const
inlineconstexpr
Parameters
[in]idxThe index of the element.

Member Data Documentation

◆ accessor_

template<typename T, size_t shift, ValidAccessor< T > Accessor>
storage<Accessor> mundy::ShiftedView< T, shift, Accessor >::accessor_