vector_push_back, _vector_push_back, vector_pop_back, _vector_pop_back, vector_push_front, _vector_push_front, vector_pop_front, _vector_pop_front - push and pop objects into and out of vectors |
#include <vector.h> #define vector_push_back(v,obj) _vector_push_back((v),&(obj)) void _vector_push_back (vector, const void *ptr); #define vector_pop_back(v,obj) _vector_pop_back((v),&(obj)) void _vector_pop_back (vector, void *ptr); #define vector_push_front(v,obj) _vector_push_front((v),&(obj)) void _vector_push_front (vector, const void *ptr); #define vector_pop_front(v,obj) _vector_pop_front((v),&(obj)) void _vector_pop_front (vector, void *ptr); |
The *_push_* functions push objects onto vectors. |
The *_pop_* functions pop objects off vectors into local variables. |
The *_front functions push and pop objects off the front of a vector. This type of operation is not very efficient, because it involves moving all other elements of the vector up or down by one place. |
The *_back functions push and pop elements off the end of the vector, which is efficient. |
Each function has two forms: a macro version and an underlying function. |
Array indexes are checked. You cannot pop an empty vector. If ptr is NULL then the popped object is discarded. |
Richard Jones <rich@annexia.org> |
GNU LGPL (see http://www.gnu.org/) |
c2lib-1.2.13 |