Public Member Functions | Friends | List of all members
Index< Dim > Class Template Reference

An integer multi-index. More...

#include <Index.hpp>

Public Member Functions

 Index (const size_t i0=std::numeric_limits< size_t >::max()) noexcept
 Construct with each element set to the same value.
 
template<typename... I, Requires<(sizeof...(I) > 1>
 Index (I... i) noexcept
 Construct specifying value in each dimension.
 
 Index (std::array< size_t, Dim > i) noexcept
 
size_t operator[] (const size_t d) const noexcept
 
size_t & operator[] (const size_t d) noexcept
 
std::array< size_t, Dim >::iterator begin ()
 
std::array< size_t, Dim >::const_iterator begin () const
 
std::array< size_t, Dim >::iterator end ()
 
std::array< size_t, Dim >::const_iterator end () const
 
size_t size () const noexcept
 
template<int N = Dim, Requires<(N > 0>
constexpr size_t product () const noexcept
 The product of the indices. If Dim = 0, the product is defined as 1.
 
template<size_t N = Dim, Requires<(N > 0>
Index< Dim - 1 > slice_away (const size_t d) const noexcept
 Return a smaller Index with the d-th element removed. More...
 
const size_t * data () const noexcept
 
size_t * data () noexcept
 
const std::array< size_t, Dim > & indices () const noexcept
 

Friends

template<size_t N>
std::ostreamoperator<< (std::ostream &os, const Index< N > &i)
 

Detailed Description

template<size_t Dim>
class Index< Dim >

An integer multi-index.

Template Parameters
Dimthe number of integers in the Index.

Member Function Documentation

◆ slice_away()

template<size_t Dim>
template<size_t N = Dim, Requires<(N > 0>
Index<Dim - 1> Index< Dim >::slice_away ( const size_t  d) const
inlinenoexcept

Return a smaller Index with the d-th element removed.

Parameters
dthe element to remove.

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