# About template types

Some of the container types listed in this section are defined for many base types. This is similar to templates in C++ and generics in Ada, but it is implemented via preprocessor macros since the C language cannot handle it. Here is the list of template types and the all base types they currently support:

vector

  Vector is currently defined for igraph_real_t, igraph_integer_t (int), char (char), igraph_bool_t (bool) and igraph_complex_t (complex). The default is igraph_real_t.

matrix

  Matrix is currently defined for igraph_real_t, igraph_integer_t (int), char (char), igraph_bool_t (bool) and igraph_complex_t (complex). The default is igraph_real_t.

array3

  Array3 is currently defined for igraph_real_t, igraph_integer_t (int), char (char) and igraph_bool_t (bool). The default is igraph_real_t.

stack

  Stack is currently defined for igraph_real_t, igraph_integer_t (int), char (char), igraph_bool_t (bool) and void* (ptr). The default is igraph_real_t.

double-ended queue

  Dqueue is currently defined for igraph_real_t, igraph_integer_t (int), char (char) and igraph_bool_t (bool). The default is igraph_real_t.

heap

  Heap is currently defined for igraph_real_t, igraph_integer_t (int), char (char). In addition both maximum and minimum heaps are available. The default is the igraph_real_t maximum heap.

list of vectors

  Lists of vectors are currently defined for vectors holding igraph_real_t and igraph_integer_t (int). The default is igraph_real_t.

list of matrices

  Lists of matrices are currently defined for matrices holding igraph_real_t only.

The name of the base element (in parentheses) is added to the function names, except for the default type.

Some examples:

- igraph_vector_t is a vector of igraph_real_t elements. Its functions are `igraph_vector_init`, `igraph_vector_destroy`, `igraph_vector_sort`, etc.

- igraph_vector_bool_t is a vector of igraph_bool_t elements; initialize it with `igraph_vector_bool_init`, destroy it with `igraph_vector_bool_destroy`, etc.

- igraph_heap_t is a maximum heap with igraph_real_t elements. The corresponding functions are `igraph_heap_init`, `igraph_heap_pop`, etc.

- igraph_heap_min_t is a minimum heap with igraph_real_t elements. The corresponding functions are called `igraph_heap_min_init`, `igraph_heap_min_pop`, etc.

- igraph_heap_int_t is a maximum heap with igraph_integer_t elements. Its functions have the `igraph_heap_int_` prefix.

- igraph_heap_min_int_t is a minimum heap containing igraph_integer_t elements. Its functions have the `igraph_heap_min_int_` prefix.

- igraph_vector_list_t is a list of (floating-point) vectors; each element in this data structure is an igraph_vector_t. Similarly, igraph_matrix_list_t is a list of (floating-point) matrices; each element in this data structure is an igraph_matrix_t.

- igraph_vector_int_list_t is a list of integer vectors; each element in this data structure is an igraph_vector_int_t.

Note that the VECTOR and the MATRIX macros can be used on all vector and matrix types. VECTOR cannot be used on lists of vectors, though, only on the individial vectors in the list.