cpp-strings 1.0.4
Pythonic c++ strings
Loading...
Searching...
No Matches
pcs::Slice< IntT > Class Template Reference

Base class for slices, with start, stop and step specified values. More...

#include <cppstrings.h>

Inheritance diagram for pcs::Slice< IntT >:
pcs::StartSlice< IntT > pcs::StartStepSlice< IntT > pcs::StartStopSlice< IntT > pcs::StepSlice< IntT > pcs::StopSlice< IntT > pcs::StopStepSlice< IntT >

Public Member Functions

template<typename CharT = char>
requires std::is_same_v<CharT, char> || std::is_same_v<CharT, char16_t> || std::is_same_v<CharT, char32_t> || std::is_same_v<CharT, wchar_t>
const IntT begin (const CppStringT< CharT > &str) noexcept
 < starts iterating on specified CppString.
const bool end () const noexcept
 < returns true when iterating is over, or false otherwise.
const IntT operator* () noexcept
 < dereferences the slice.
Slice operator++ () noexcept
 < iterates one step, pre-increment. Caution: index may be out of bounds. Check '!end()' before dereferencing the slice.
Slice operator++ (int) noexcept
 < iterates one step, post-increment. Caution: index may be out of bounds. Check '!end()' before dereferencing the slice.
 Slice (const IntT start=DEFAULT, const IntT stop=DEFAULT, const IntT step=DEFAULT) noexcept
 < Valued constructor
IntT start ()
 Returns the start index of this slide.
IntT step ()
 Returns the step value of this slide.
IntT stop ()
 Returns the stop index of this slide.
virtual ~Slice () noexcept=default
 Default destructor.

Static Public Attributes

static constexpr IntT DEFAULT { std::numeric_limits<IntT>::min() }

Detailed Description

template<typename IntT>
requires std::is_signed_v<IntT>
class pcs::Slice< IntT >

Base class for slices, with start, stop and step specified values.

Constructor & Destructor Documentation

◆ Slice()

template<typename IntT>
pcs::Slice< IntT >::Slice ( const IntT start = DEFAULT,
const IntT stop = DEFAULT,
const IntT step = DEFAULT )
inlinenoexcept

< Valued constructor

References start(), step(), and stop().

Referenced by operator++(), and operator++().

◆ ~Slice()

template<typename IntT>
virtual pcs::Slice< IntT >::~Slice ( )
virtualdefaultnoexcept

Default destructor.

Member Function Documentation

◆ begin()

template<typename IntT>
template<typename CharT = char>
requires std::is_same_v<CharT, char> || std::is_same_v<CharT, char16_t> || std::is_same_v<CharT, char32_t> || std::is_same_v<CharT, wchar_t>
const IntT pcs::Slice< IntT >::begin ( const CppStringT< CharT > & str)
inlinenoexcept

< starts iterating on specified CppString.

◆ end()

template<typename IntT>
const bool pcs::Slice< IntT >::end ( ) const
inlinenodiscardnoexcept

< returns true when iterating is over, or false otherwise.

◆ operator*()

template<typename IntT>
const IntT pcs::Slice< IntT >::operator* ( )
inlinenodiscardnoexcept

< dereferences the slice.

◆ operator++() [1/2]

template<typename IntT>
Slice pcs::Slice< IntT >::operator++ ( )
inlinenoexcept

< iterates one step, pre-increment. Caution: index may be out of bounds. Check '!end()' before dereferencing the slice.

References Slice().

◆ operator++() [2/2]

template<typename IntT>
Slice pcs::Slice< IntT >::operator++ ( int )
inlinenoexcept

< iterates one step, post-increment. Caution: index may be out of bounds. Check '!end()' before dereferencing the slice.

References Slice().

◆ start()

template<typename IntT>
IntT pcs::Slice< IntT >::start ( )
inline

◆ step()

template<typename IntT>
IntT pcs::Slice< IntT >::step ( )
inline

◆ stop()

template<typename IntT>
IntT pcs::Slice< IntT >::stop ( )
inline

The documentation for this class was generated from the following file:
  • cppstrings.h