Instigate Open Source Documentation

instigate::stl::vector::interface< T > Struct Template Reference

Interface for the Vector Concept. More...

#include <_vector.hpp>

Inheritance diagram for instigate::stl::vector::interface< T >:

instigate::generic::assignable::interface< T > instigate::generic::default_constructible::interface< T >

List of all members.

Public Types

typedef T::size_type size_type
 Typename for the index type and vector size type.
typedef T::value_type value_type
 Typename for the vector elements.

Static Public Member Functions

static size_type get_size (const T &x)
 Returns the size of the vector.
static value_type get_element (const T &x, const size_type &i)
 Gets element of a vector by index.
static void set_element (T &x, const size_type &i, const value_type &v)
 Modifies value of element with given index.
static void construct (T &x, const size_type &i)
 Constructs vector with the given size.


Detailed Description

template<typename T>
struct instigate::stl::vector::interface< T >

Interface for the Vector Concept.

This is a "non-intrusive" interface for the vector type. A type is vector if it is possible to query it's size and to access it's elements by index in constant-time.

The default implementation is made so that std::vector<T> automatically becomes a model of this concept.

Todo:
Also provide specialization for C arrays with fixed size.

Member Function Documentation

template<typename T>
static size_type instigate::stl::vector::interface< T >::get_size ( const T &  x  )  [inline, static]

Returns the size of the vector.

Parameters:
x The vector.
Complexity
Must be O(1).

Referenced by instigate::stl::vector::interface< T >::get_element(), and instigate::stl::vector::interface< T >::set_element().

template<typename T>
static value_type instigate::stl::vector::interface< T >::get_element ( const T &  x,
const size_type i 
) [inline, static]

Gets element of a vector by index.

Parameters:
x The vector.
i The index of element.
Returns:
The element of x with index i.

References instigate::stl::vector::interface< T >::get_size().

template<typename T>
static void instigate::stl::vector::interface< T >::set_element ( T &  x,
const size_type i,
const value_type v 
) [inline, static]

Modifies value of element with given index.

Parameters:
x The vector.
i The index of the element.
v The new value for the element.

References instigate::stl::vector::interface< T >::get_size().

template<typename T>
static void instigate::stl::vector::interface< T >::construct ( T &  x,
const size_type i 
) [inline, static]

Constructs vector with the given size.

Parameters:
x The vector.
i The size of the vector.


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


© Instigate CJSC, Open Source