Data Structures | Functions

viennagrid::traits Namespace Reference

A generic layer for accessing containers such as std::vector, std::deque, std::map, etc. More...

Data Structures

struct  dimension< point_t< CoordType, CoordinateSystem > >
 Returns the geometric dimension of a point. Specialization for a ViennaGrid point. More...
struct  coordinate_system
 Returns the coordinate system of a point. Must be specialized for a user-provided point type. More...
struct  coordinate_system< point_t< CoordType, CoordinateSystem > >
 Returns the coordinate system of a point. Specialization for a ViennaGrid point. More...
struct  static_size< point_t< CoordType, CoordinateSystem > >
 Returns the static (compile time) size of a point. Specialization for a ViennaGrid point. More...
struct  value_type< point_t< CoordType, CoordinateSystem > >
 Value Type retrieval for a point. Returns the numeric type of each coordinate entry. Specialization for a ViennaGrid point. More...

Functions

template<typename T >
void reserve (T &t, std::size_t new_size)
 Reserve memory in a container. Default case: Do nothing, because the container might not have a reserve() function.
template<typename T , typename A >
void reserve (std::vector< T, A > &vec, std::size_t new_size)
 Reserve memory in a vector.
template<typename T >
void resize (T &t, std::size_t new_size)
 Resize a container. Default case: Do nothing, because the container might not have a resize() function.
template<typename T , typename A >
void resize (std::vector< T, A > &vec, std::size_t new_size)
 Resize a vector.
template<typename T >
std::size_t size (T &t)
 Generic determination of the size of a container. Assuming a .size() member by default. Can be overloaded for user types.
template<typename T >
std::size_t capacity (T &t)
 Capacity of a container. Default case: 'infinite'.
template<typename T , typename A >
std::size_t capacity (std::vector< T, A > &vec, std::size_t new_size)
 Capacity of a container. Overload for a std::vector.
template<typename PointType >
std::size_t dynamic_size (PointType const &p)
 Returns the dynamic (run time) size of a point. Assumes a .size() member. Other cases must be provided with overloads.

Detailed Description

A generic layer for accessing containers such as std::vector, std::deque, std::map, etc.


Function Documentation

std::size_t viennagrid::traits::capacity ( T &  t  ) 

Capacity of a container. Default case: 'infinite'.

std::size_t viennagrid::traits::capacity ( std::vector< T, A > &  vec,
std::size_t  new_size 
)

Capacity of a container. Overload for a std::vector.

std::size_t viennagrid::traits::dynamic_size ( PointType const &  p  ) 

Returns the dynamic (run time) size of a point. Assumes a .size() member. Other cases must be provided with overloads.

void viennagrid::traits::reserve ( std::vector< T, A > &  vec,
std::size_t  new_size 
)

Reserve memory in a vector.

void viennagrid::traits::reserve ( T &  t,
std::size_t  new_size 
)

Reserve memory in a container. Default case: Do nothing, because the container might not have a reserve() function.

void viennagrid::traits::resize ( std::vector< T, A > &  vec,
std::size_t  new_size 
)

Resize a vector.

void viennagrid::traits::resize ( T &  t,
std::size_t  new_size 
)

Resize a container. Default case: Do nothing, because the container might not have a resize() function.

std::size_t viennagrid::traits::size ( T &  t  ) 

Generic determination of the size of a container. Assuming a .size() member by default. Can be overloaded for user types.