TRIQS/itertools 1.3.0
C++ range library
Loading...
Searching...
No Matches
itertools::sliced< R >

#include <itertools/slice.hpp>

Detailed Description

template<typename R>
struct itertools::sliced< R >

Represents a sliced range.

See itertools::slice(R &&, std::ptrdiff_t, std::ptrdiff_t) for more details.

Template Parameters
RRange type.

Definition at line 42 of file slice.hpp.

Public Types

using const_iterator = decltype(std::cbegin(rg))
 Const iterator type of the sliced range.
 
using iterator = decltype(std::begin(rg))
 Iterator type of the sliced range.
 

Public Member Functions

const_iterator begin () const noexcept
 Const overload of begin().
 
iterator begin () noexcept
 Beginning of the sliced range.
 
const_iterator cbegin () const noexcept
 Const version of begin().
 
const_iterator cend () const noexcept
 Const version of end().
 
const_iterator end () const noexcept
 Const overload of end().
 
iterator end () noexcept
 End of the sliced range.
 
bool operator== (sliced const &) const =default
 Default equal-to operator.
 
std::ptrdiff_t size () const
 Helper function to calculate the size of the sliced range.
 

Public Attributes

std::ptrdiff_t end_idx
 Index at which the sliced range ends.
 
rg
 Original range.
 
std::ptrdiff_t start_idx
 Index at which the sliced range starts.
 

Member Function Documentation

◆ begin()

template<typename R >
iterator itertools::sliced< R >::begin ( )
inlinenodiscardnoexcept

Beginning of the sliced range.

Returns
Iterator to the beginning of the sliced range.

Definition at line 74 of file slice.hpp.

◆ end()

template<typename R >
iterator itertools::sliced< R >::end ( )
inlinenodiscardnoexcept

End of the sliced range.

Returns
Iterator to the end of the sliced range.

Definition at line 86 of file slice.hpp.

◆ size()

template<typename R >
std::ptrdiff_t itertools::sliced< R >::size ( ) const
inlinenodiscard

Helper function to calculate the size of the sliced range.

Returns
Number of elements in the slice.

Definition at line 65 of file slice.hpp.


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