Elm  2
ELM is a library providing generic data structures, OS-independent interface, plugins and XML.
Slice< C > Class Template Reference

#include <elm/data/Slice.h>

Classes

class  BaseIter
 
class  Iter
 
class  MutIter
 

Public Types

typedef Slice< C > self_t
 
typedef C::t t
 

Public Member Functions

 Slice ()
 
 Slice (C &array, int first, int count)
 
C & array () const
 
int firstIndex () const
 
int lastIndex () const
 
int count () const
 
const tget (int i) const
 
const toperator[] (int i) const
 
tget (int i)
 
toperator[] (int i)
 
int length () const
 
int indexOf (const t &x, int i=0) const
 
int lastIndexOf (const t &x, int i=-1) const
 
Iter begin () const
 
Iter end () const
 
bool contains (const t &x) const
 
bool containsAll (const self_t &s) const
 
bool isEmpty () const
 
 operator bool () const
 
bool equals (const self_t &s) const
 
bool operator== (const self_t &s) const
 
bool operator!= (const self_t &s) const
 
MutIter begin ()
 
MutIter end ()
 

Detailed Description

template<class C>
class elm::Slice< C >

This class implement a light-weight array collection representing a slice of another array collection.

Slice implements the following concepts:

Parameters
TType of elements in the slice.
DType of the array data structure.

Member Typedef Documentation

◆ self_t

typedef Slice<C> self_t

◆ t

typedef C::t t

Constructor & Destructor Documentation

◆ Slice() [1/2]

Slice ( )
inline

◆ Slice() [2/2]

Slice ( C &  array,
int  first,
int  count 
)
inline

Member Function Documentation

◆ array()

D & array ( ) const
inline

Get the parent array.

Returns
Parent array.

◆ begin() [1/2]

MutIter begin ( )
inline

◆ begin() [2/2]

Iter begin ( ) const
inline

◆ contains()

bool contains ( const t x) const
inline

◆ containsAll()

bool containsAll ( const self_t s) const
inline

◆ count()

int count ( ) const
inline

Referenced by Slice< C >::length().

◆ end() [1/2]

MutIter end ( )
inline

◆ end() [2/2]

Iter end ( ) const
inline

◆ equals()

bool equals ( const self_t s) const
inline

◆ firstIndex()

int firstIndex ( ) const
inline

Get the index, in the parent array, of the first element of the slice.

Returns
Index of first element in the parent array.

◆ get() [1/2]

t& get ( int  i)
inline

◆ get() [2/2]

const t& get ( int  i) const
inline

◆ indexOf()

int indexOf ( const t x,
int  i = 0 
) const
inline

References Slice< C >::get().

Referenced by Slice< C >::contains().

◆ isEmpty()

bool isEmpty ( ) const
inline

◆ lastIndex()

int lastIndex ( ) const
inline

Get the index, in the parent array, of the last element of the slice.

Returns
Index of last element in the parent array.

◆ lastIndexOf()

int lastIndexOf ( const t x,
int  i = -1 
) const
inline

References Slice< C >::get().

◆ length()

int length ( ) const
inline

References Slice< C >::count().

◆ operator bool()

operator bool ( ) const
inline

References Slice< C >::isEmpty().

◆ operator!=()

bool operator!= ( const self_t s) const
inline

References Slice< C >::equals().

◆ operator==()

bool operator== ( const self_t s) const
inline

References Slice< C >::equals().

◆ operator[]() [1/2]

t& operator[] ( int  i)
inline

References Slice< C >::get().

◆ operator[]() [2/2]

const t& operator[] ( int  i) const
inline

References Slice< C >::get().


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