DUECA/DUSIME
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
dueca::limvector< N, T > Class Template Reference

Variable-sized vector of limited size; allocates all its memory in one go, requires a size of sizeof(size_t) + sizeof(pointer) + N * sizeof(data) More...

#include <limvector.hxx>

Public Types

typedef T value_type
 Type of the contained object.
 
typedef Tpointer
 Type of a pointer to the contained object.
 
typedef Treference
 Type of a reference to the contained object.
 
typedef const Tconst_reference
 Type of a reference to the contained object.
 
typedef const Tconst_pointer
 Type of a pointer to the contained object.
 
typedef pointer iterator
 Define the iterator type.
 
typedef const_pointer const_iterator
 Define the const iterator type.
 
typedef std::reverse_iterator< const_iteratorconst_reverse_iterator
 Define the reverse const iterator type.
 
typedef std::reverse_iterator< iteratorreverse_iterator
 Define the reverse iterator type.
 
typedef std::random_access_iterator_tag iterator_category
 Show random access is possible.
 
typedef size_t size_type
 Size of the underlying thing.
 
typedef std::ptrdiff_t difference_type
 Pointer difference.
 

Public Member Functions

 limvector (size_t n, const T &defval)
 constructor with default value for the data
 
 limvector (size_t n=0)
 constructor without default value for the data
 
 limvector (const limvector< N, T > &other)
 copy constructor
 
template<class InputIt >
 limvector (InputIt first, InputIt last)
 construct from iterators
 
 ~limvector ()
 destructor
 
 operator pointer (void)
 obtain a pointer directly to the data
 
 operator const_pointer (void) const
 obtain a const pointer directly to the data
 
iterator begin ()
 more-or-less stl-compatible iterator
 
iterator end ()
 more-or-less stl-compatible iterator
 
const_iterator begin () const
 more-or-less stl-compatible iterator
 
const_iterator end () const
 more-or-less stl-compatible iterator
 
size_t size () const
 size of the vector
 
limvector< N, T > & operator= (const limvector< N, T > &other)
 assignment operator
 
limvector< N, T > & operator= (const T &val)
 assignment operator, to value type
 
bool operator== (const limvector< N, T > &other) const
 equality test
 
bool operator!= (const limvector< N, T > &other) const
 inequality test
 
template<typename idx_t >
const Toperator[] (idx_t ii) const
 access elements of the vector.
 
template<typename idx_t >
Toperator[] (idx_t ii)
 access elements of the vector.
 
void resize (size_t s, const value_type &val=value_type())
 forced resize of the vector
 
const Tptr () const
 access as const pointer
 
Tptr ()
 access as pointer
 
void push_back (const value_type &__x)
 push_back, but note the limit!
 
void pop_back (const value_type &__x)
 pop_back, really inefficient!
 
reference front ()
 access first element
 
const_reference front () const
 access first element
 
reference back ()
 access last element
 
const_reference back () const
 access last element
 

Detailed Description

template<size_t N, typename T>
class dueca::limvector< N, T >

Variable-sized vector of limited size; allocates all its memory in one go, requires a size of sizeof(size_t) + sizeof(pointer) + N * sizeof(data)

Implementing most stl-like interfaces

Constructor & Destructor Documentation

◆ limvector() [1/2]

template<size_t N, typename T >
dueca::limvector< N, T >::limvector ( size_t n,
const T & defval )
inline

constructor with default value for the data

Parameters
nlength of vector
defvaldefault fill value

◆ limvector() [2/2]

template<size_t N, typename T >
dueca::limvector< N, T >::limvector ( size_t n = 0)
inline

constructor without default value for the data

Parameters
nlength of vector

Member Function Documentation

◆ operator[]() [1/2]

template<size_t N, typename T >
template<typename idx_t >
const T & dueca::limvector< N, T >::operator[] ( idx_t ii) const
inline

access elements of the vector.

Note that indexing is checked

◆ operator[]() [2/2]

template<size_t N, typename T >
template<typename idx_t >
T & dueca::limvector< N, T >::operator[] ( idx_t ii)
inline

access elements of the vector.

Note that indexing is checked


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