\hypertarget{vector_8h}{}\doxysection{vector.\+h File Reference}
\label{vector_8h}\index{vector.h@{vector.h}}
{\ttfamily \#include $<$stddef.\+h$>$}\newline
{\ttfamily \#include $<$string.\+h$>$}\newline
{\ttfamily \#include \char`\"{}declare.\+h\char`\"{}}\newline
\doxysubsection*{Macros}
\begin{DoxyCompactItemize}
\item 
\#define \mbox{\hyperlink{vector_8h_a0faac4691e1f01b9eef9df3f036012b5}{Vector\+Struct}}(T)
\item 
\#define \mbox{\hyperlink{vector_8h_a0515d7df5451e88d8064a80b238d156d}{Vector}}(T,  X)~\mbox{\hyperlink{vector_8h_a0faac4691e1f01b9eef9df3f036012b5}{Vector\+Struct}}(T) X = \{ N\+U\+LL, 0, 0 \}
\item 
\#define \mbox{\hyperlink{vector_8h_aaf9d4a762fd84d66e1acc82d47d6f9b4}{Declare\+Vector}}(T,  X)~\mbox{\hyperlink{vector_8h_a0faac4691e1f01b9eef9df3f036012b5}{Vector\+Struct}}(T) X
\item 
\#define \mbox{\hyperlink{vector_8h_a6bf55d1b0f0ea3e74db7f077a9e00a3b}{Vector\+Init}}(X)
\item 
\#define \mbox{\hyperlink{vector_8h_a53b43d4471c85ecd25c50df12119cccc}{Vector\+Free}}(X)
\item 
\#define \mbox{\hyperlink{vector_8h_aa1973d9deef8a3a69199b9c3cf027acf}{Vector\+Ptr}}(X)~((X).ptr)
\item 
\#define \mbox{\hyperlink{vector_8h_a396bceb52821aaf6c59f89337411d66a}{Vector\+Front}}(X)~((X).ptr\mbox{[}0\mbox{]})
\item 
\#define \mbox{\hyperlink{vector_8h_a60c736ed22d81889fd8a166bf2647e4c}{Vector\+Back}}(X)~((X).ptr\mbox{[}(X).size -\/ 1\mbox{]})
\item 
\#define \mbox{\hyperlink{vector_8h_a62677f923a531566c4bc9d0201e61cc3}{Vector\+Size}}(X)~((X).size)
\item 
\#define \mbox{\hyperlink{vector_8h_a6a366d93bf00d4510f02469c4000a513}{Vector\+Capacity}}(X)~((X).capacity)
\item 
\#define \mbox{\hyperlink{vector_8h_ad145b5feffb63252295e535ac6e3e306}{Vector\+Empty}}(X)~((X).size == 0)
\item 
\#define \mbox{\hyperlink{vector_8h_a3d9541003f8982ef5a2389911b6393f7}{Vector\+Clear}}(X)~do \{ (X).size = 0; \} while (0)
\item 
\#define \mbox{\hyperlink{vector_8h_a413f4644af30b520077d555fb77eabe4}{Vector\+Reserve}}(X,  newcapacity)
\item 
\#define \mbox{\hyperlink{vector_8h_a6bcf973a5d30c022bb570846dc20d56c}{Vector\+Push\+Back}}(X,  x)
\item 
\#define \mbox{\hyperlink{vector_8h_afb9326147d85d6b316f16b2399b7d6ed}{Vector\+Push\+Backs}}(X,  src,  n)
\item 
\#define \mbox{\hyperlink{vector_8h_a5d8825b2aa7a8c162dc581fa4b013744}{Vector\+Pop\+Back}}(X)~do \{ (X).size -\/-\/; \} while (0)
\item 
\#define \mbox{\hyperlink{vector_8h_aad81ee92470b85556cf9ef37f81165e3}{Vector\+Insert}}(X,  index,  x)
\item 
\#define \mbox{\hyperlink{vector_8h_afe4b00b95a6f121c7a2774decd594bd0}{Vector\+Inserts}}(X,  index,  src,  n)
\item 
\#define \mbox{\hyperlink{vector_8h_a13c01eebcaab19947f96d1e1af0df64a}{Vector\+Erase}}(X,  index)
\item 
\#define \mbox{\hyperlink{vector_8h_a2202cc8095f318cc2d6db10ba93dcb92}{Vector\+Erases}}(X,  index,  n)
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
An implementation of dynamic array.

Example\+: 
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordtype}{size\_t} i;}
\DoxyCodeLine{\mbox{\hyperlink{vector_8h_a0515d7df5451e88d8064a80b238d156d}{Vector}}(\textcolor{keywordtype}{int}, vec);}
\DoxyCodeLine{\mbox{\hyperlink{vector_8h_a6bcf973a5d30c022bb570846dc20d56c}{VectorPushBack}}(vec, 1);}
\DoxyCodeLine{\mbox{\hyperlink{vector_8h_a6bcf973a5d30c022bb570846dc20d56c}{VectorPushBack}}(vec, 2);}
\DoxyCodeLine{\mbox{\hyperlink{vector_8h_a6bcf973a5d30c022bb570846dc20d56c}{VectorPushBack}}(vec, 3);}
\DoxyCodeLine{\textcolor{keywordflow}{for} ( i = 0; i < \mbox{\hyperlink{vector_8h_a62677f923a531566c4bc9d0201e61cc3}{VectorSize}}(vec); i++ )}
\DoxyCodeLine{  printf(\textcolor{stringliteral}{"\%d\(\backslash\)n"}, \mbox{\hyperlink{vector_8h_aa1973d9deef8a3a69199b9c3cf027acf}{VectorPtr}}(vec)[i]);}
\DoxyCodeLine{\mbox{\hyperlink{vector_8h_a53b43d4471c85ecd25c50df12119cccc}{VectorFree}}(vec);}
\end{DoxyCode}
 

\doxysubsection{Macro Definition Documentation}
\mbox{\Hypertarget{vector_8h_a0faac4691e1f01b9eef9df3f036012b5}\label{vector_8h_a0faac4691e1f01b9eef9df3f036012b5}} 
\index{vector.h@{vector.h}!VectorStruct@{VectorStruct}}
\index{VectorStruct@{VectorStruct}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorStruct}{VectorStruct}}
{\footnotesize\ttfamily \#define Vector\+Struct(\begin{DoxyParamCaption}\item[{}]{T }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keyword}{struct }\{ \(\backslash\)}
\DoxyCodeLine{        T *ptr; \(\backslash\)}
\DoxyCodeLine{        size\_t size; \(\backslash\)}
\DoxyCodeLine{        size\_t capacity; \(\backslash\)}
\DoxyCodeLine{    \}}

\end{DoxyCode}
A struct for vector objects.


\begin{DoxyParams}{Parameters}
{\em T} & the type of elements. \\
\hline
\end{DoxyParams}


Definition at line 65 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a0515d7df5451e88d8064a80b238d156d}\label{vector_8h_a0515d7df5451e88d8064a80b238d156d}} 
\index{vector.h@{vector.h}!Vector@{Vector}}
\index{Vector@{Vector}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{Vector}{Vector}}
{\footnotesize\ttfamily \#define Vector(\begin{DoxyParamCaption}\item[{}]{T,  }\item[{}]{X }\end{DoxyParamCaption})~\mbox{\hyperlink{vector_8h_a0faac4691e1f01b9eef9df3f036012b5}{Vector\+Struct}}(T) X = \{ N\+U\+LL, 0, 0 \}}

Defines and initialises a vector X of the type T. The user must call \mbox{\hyperlink{vector_8h_a53b43d4471c85ecd25c50df12119cccc}{Vector\+Free(\+X)}} after the use of X.


\begin{DoxyParams}{Parameters}
{\em T} & the type of elements. \\
\hline
{\em X} & the name of vector object \\
\hline
\end{DoxyParams}


Definition at line 84 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_aaf9d4a762fd84d66e1acc82d47d6f9b4}\label{vector_8h_aaf9d4a762fd84d66e1acc82d47d6f9b4}} 
\index{vector.h@{vector.h}!DeclareVector@{DeclareVector}}
\index{DeclareVector@{DeclareVector}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{DeclareVector}{DeclareVector}}
{\footnotesize\ttfamily \#define Declare\+Vector(\begin{DoxyParamCaption}\item[{}]{T,  }\item[{}]{X }\end{DoxyParamCaption})~\mbox{\hyperlink{vector_8h_a0faac4691e1f01b9eef9df3f036012b5}{Vector\+Struct}}(T) X}

Declares a vector X of the type T. The user must call \mbox{\hyperlink{vector_8h_a6bf55d1b0f0ea3e74db7f077a9e00a3b}{Vector\+Init(\+X)}} before the use of X.


\begin{DoxyParams}{Parameters}
{\em T} & the type of elements. \\
\hline
{\em X} & the name of vector object \\
\hline
\end{DoxyParams}


Definition at line 99 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a6bf55d1b0f0ea3e74db7f077a9e00a3b}\label{vector_8h_a6bf55d1b0f0ea3e74db7f077a9e00a3b}} 
\index{vector.h@{vector.h}!VectorInit@{VectorInit}}
\index{VectorInit@{VectorInit}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorInit}{VectorInit}}
{\footnotesize\ttfamily \#define Vector\+Init(\begin{DoxyParamCaption}\item[{}]{X }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{        (X).ptr = NULL; \(\backslash\)}
\DoxyCodeLine{        (X).size = 0; \(\backslash\)}
\DoxyCodeLine{        (X).capacity = 0; \(\backslash\)}
\DoxyCodeLine{    \} \textcolor{keywordflow}{while} (0)}

\end{DoxyCode}
Initialises a vector X of the type T. The user must call \mbox{\hyperlink{vector_8h_a53b43d4471c85ecd25c50df12119cccc}{Vector\+Free(\+X)}} after the use of X.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
\end{DoxyParams}


Definition at line 113 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a53b43d4471c85ecd25c50df12119cccc}\label{vector_8h_a53b43d4471c85ecd25c50df12119cccc}} 
\index{vector.h@{vector.h}!VectorFree@{VectorFree}}
\index{VectorFree@{VectorFree}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorFree}{VectorFree}}
{\footnotesize\ttfamily \#define Vector\+Free(\begin{DoxyParamCaption}\item[{}]{X }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{        M\_free((X).ptr, \textcolor{stringliteral}{"VectorFree:"} \#X); \(\backslash\)}
\DoxyCodeLine{        (X).ptr = NULL; \(\backslash\)}
\DoxyCodeLine{        (X).size = 0; \(\backslash\)}
\DoxyCodeLine{        (X).capacity = 0; \(\backslash\)}
\DoxyCodeLine{    \} \textcolor{keywordflow}{while} (0)}

\end{DoxyCode}
Frees the buffer allocated by the vector X.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
\end{DoxyParams}


Definition at line 130 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_aa1973d9deef8a3a69199b9c3cf027acf}\label{vector_8h_aa1973d9deef8a3a69199b9c3cf027acf}} 
\index{vector.h@{vector.h}!VectorPtr@{VectorPtr}}
\index{VectorPtr@{VectorPtr}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorPtr}{VectorPtr}}
{\footnotesize\ttfamily \#define Vector\+Ptr(\begin{DoxyParamCaption}\item[{}]{X }\end{DoxyParamCaption})~((X).ptr)}

Returns the pointer to the buffer for the vector X. N\+U\+LL when \mbox{\hyperlink{vector_8h_a6a366d93bf00d4510f02469c4000a513}{Vector\+Capacity(\+X)}} == 0.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the pointer to the allocated buffer for the vector. 
\end{DoxyReturn}


Definition at line 150 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a396bceb52821aaf6c59f89337411d66a}\label{vector_8h_a396bceb52821aaf6c59f89337411d66a}} 
\index{vector.h@{vector.h}!VectorFront@{VectorFront}}
\index{VectorFront@{VectorFront}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorFront}{VectorFront}}
{\footnotesize\ttfamily \#define Vector\+Front(\begin{DoxyParamCaption}\item[{}]{X }\end{DoxyParamCaption})~((X).ptr\mbox{[}0\mbox{]})}

Returns the first element of the vector X. Undefined when \mbox{\hyperlink{vector_8h_a62677f923a531566c4bc9d0201e61cc3}{Vector\+Size(\+X)}} == 0.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the first element of the vector. 
\end{DoxyReturn}


Definition at line 165 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a60c736ed22d81889fd8a166bf2647e4c}\label{vector_8h_a60c736ed22d81889fd8a166bf2647e4c}} 
\index{vector.h@{vector.h}!VectorBack@{VectorBack}}
\index{VectorBack@{VectorBack}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorBack}{VectorBack}}
{\footnotesize\ttfamily \#define Vector\+Back(\begin{DoxyParamCaption}\item[{}]{X }\end{DoxyParamCaption})~((X).ptr\mbox{[}(X).size -\/ 1\mbox{]})}

Returns the last element of the vector X. Undefined when \mbox{\hyperlink{vector_8h_a62677f923a531566c4bc9d0201e61cc3}{Vector\+Size(\+X)}} == 0.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the last element of the vector. 
\end{DoxyReturn}


Definition at line 180 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a62677f923a531566c4bc9d0201e61cc3}\label{vector_8h_a62677f923a531566c4bc9d0201e61cc3}} 
\index{vector.h@{vector.h}!VectorSize@{VectorSize}}
\index{VectorSize@{VectorSize}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorSize}{VectorSize}}
{\footnotesize\ttfamily \#define Vector\+Size(\begin{DoxyParamCaption}\item[{}]{X }\end{DoxyParamCaption})~((X).size)}

Returns the size of the vector X.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the size of the vetor. 
\end{DoxyReturn}


Definition at line 194 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a6a366d93bf00d4510f02469c4000a513}\label{vector_8h_a6a366d93bf00d4510f02469c4000a513}} 
\index{vector.h@{vector.h}!VectorCapacity@{VectorCapacity}}
\index{VectorCapacity@{VectorCapacity}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorCapacity}{VectorCapacity}}
{\footnotesize\ttfamily \#define Vector\+Capacity(\begin{DoxyParamCaption}\item[{}]{X }\end{DoxyParamCaption})~((X).capacity)}

Returns the capacity (the number of the already allocated elements) of the vector X.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the capacity of the vetor. 
\end{DoxyReturn}


Definition at line 208 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_ad145b5feffb63252295e535ac6e3e306}\label{vector_8h_ad145b5feffb63252295e535ac6e3e306}} 
\index{vector.h@{vector.h}!VectorEmpty@{VectorEmpty}}
\index{VectorEmpty@{VectorEmpty}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorEmpty}{VectorEmpty}}
{\footnotesize\ttfamily \#define Vector\+Empty(\begin{DoxyParamCaption}\item[{}]{X }\end{DoxyParamCaption})~((X).size == 0)}

Returns true the size of the vector X is zero.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true if the vector has no elements, false otherwise. 
\end{DoxyReturn}


Definition at line 222 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a3d9541003f8982ef5a2389911b6393f7}\label{vector_8h_a3d9541003f8982ef5a2389911b6393f7}} 
\index{vector.h@{vector.h}!VectorClear@{VectorClear}}
\index{VectorClear@{VectorClear}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorClear}{VectorClear}}
{\footnotesize\ttfamily \#define Vector\+Clear(\begin{DoxyParamCaption}\item[{}]{X }\end{DoxyParamCaption})~do \{ (X).size = 0; \} while (0)}

Sets the size of the vector X to zero.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
\end{DoxyParams}


Definition at line 235 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a413f4644af30b520077d555fb77eabe4}\label{vector_8h_a413f4644af30b520077d555fb77eabe4}} 
\index{vector.h@{vector.h}!VectorReserve@{VectorReserve}}
\index{VectorReserve@{VectorReserve}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorReserve}{VectorReserve}}
{\footnotesize\ttfamily \#define Vector\+Reserve(\begin{DoxyParamCaption}\item[{}]{X,  }\item[{}]{newcapacity }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{        size\_t v\_tmp\_newcapacity\_ = (newcapacity); \(\backslash\)}
\DoxyCodeLine{        if ( (X).capacity < v\_tmp\_newcapacity\_ ) \{ \(\backslash\)}
\DoxyCodeLine{            void *v\_tmp\_newptr\_; \(\backslash\)}
\DoxyCodeLine{            v\_tmp\_newcapacity\_ = (v\_tmp\_newcapacity\_ * 3) / 2; \(\backslash\)}
\DoxyCodeLine{            if ( v\_tmp\_newcapacity\_ < 4 ) v\_tmp\_newcapacity\_ = 4; \(\backslash\)}
\DoxyCodeLine{            v\_tmp\_newptr\_ = Malloc1(sizeof((X).ptr[0]) * v\_tmp\_newcapacity\_, "\mbox{\hyperlink{vector_8h_a413f4644af30b520077d555fb77eabe4}{VectorReserve}}:" \textcolor{preprocessor}{\#X); \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{            if ( (X).ptr != NULL ) \{ \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{                memcpy(v\_tmp\_newptr\_, (X).ptr, (X).size * sizeof((X).ptr[0])); \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{                M\_free((X).ptr, "VectorReserve:" \#X); \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{            \} \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{            (X).ptr = v\_tmp\_newptr\_; \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{            (X).capacity = v\_tmp\_newcapacity\_; \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{        \} \(\backslash\)}}
\DoxyCodeLine{\textcolor{preprocessor}{    \} while (0)}}

\end{DoxyCode}
Requires that the capacity of the vector X is equal to or lager than newcapacity.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
{\em newcapacity} & the capacity to be reserved. \\
\hline
\end{DoxyParams}


Definition at line 249 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a6bcf973a5d30c022bb570846dc20d56c}\label{vector_8h_a6bcf973a5d30c022bb570846dc20d56c}} 
\index{vector.h@{vector.h}!VectorPushBack@{VectorPushBack}}
\index{VectorPushBack@{VectorPushBack}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorPushBack}{VectorPushBack}}
{\footnotesize\ttfamily \#define Vector\+Push\+Back(\begin{DoxyParamCaption}\item[{}]{X,  }\item[{}]{x }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{        VectorReserve((X), (X).size + 1); \(\backslash\)}
\DoxyCodeLine{        (X).ptr[(X).size++] = (x); \(\backslash\)}
\DoxyCodeLine{    \} \textcolor{keywordflow}{while} (0)}

\end{DoxyCode}
Adds an element x at the end of the vector X.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
{\em x} & the element to be added. \\
\hline
\end{DoxyParams}


Definition at line 277 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_afb9326147d85d6b316f16b2399b7d6ed}\label{vector_8h_afb9326147d85d6b316f16b2399b7d6ed}} 
\index{vector.h@{vector.h}!VectorPushBacks@{VectorPushBacks}}
\index{VectorPushBacks@{VectorPushBacks}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorPushBacks}{VectorPushBacks}}
{\footnotesize\ttfamily \#define Vector\+Push\+Backs(\begin{DoxyParamCaption}\item[{}]{X,  }\item[{}]{src,  }\item[{}]{n }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{        size\_t v\_tmp\_n\_ = (n); \(\backslash\)}
\DoxyCodeLine{        VectorReserve((X), (X).size + v\_tmp\_n\_); \(\backslash\)}
\DoxyCodeLine{        memcpy((X).ptr + (X).size, (src), v\_tmp\_n\_ * \textcolor{keyword}{sizeof}((X).ptr[0])); \(\backslash\)}
\DoxyCodeLine{        (X).size += v\_tmp\_n\_; \(\backslash\)}
\DoxyCodeLine{    \} \textcolor{keywordflow}{while} (0)}

\end{DoxyCode}
Adds an n elements of src at the end of the vector X.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
{\em src} & the starting address of the buffer storing elements to be added. \\
\hline
{\em n} & the number of elements to be added. \\
\hline
\end{DoxyParams}


Definition at line 295 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a5d8825b2aa7a8c162dc581fa4b013744}\label{vector_8h_a5d8825b2aa7a8c162dc581fa4b013744}} 
\index{vector.h@{vector.h}!VectorPopBack@{VectorPopBack}}
\index{VectorPopBack@{VectorPopBack}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorPopBack}{VectorPopBack}}
{\footnotesize\ttfamily \#define Vector\+Pop\+Back(\begin{DoxyParamCaption}\item[{}]{X }\end{DoxyParamCaption})~do \{ (X).size -\/-\/; \} while (0)}

Removes the last element of the vector X. \mbox{\hyperlink{vector_8h_a62677f923a531566c4bc9d0201e61cc3}{Vector\+Size(\+X)}} must be $>$ 0.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
\end{DoxyParams}


Definition at line 314 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_aad81ee92470b85556cf9ef37f81165e3}\label{vector_8h_aad81ee92470b85556cf9ef37f81165e3}} 
\index{vector.h@{vector.h}!VectorInsert@{VectorInsert}}
\index{VectorInsert@{VectorInsert}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorInsert}{VectorInsert}}
{\footnotesize\ttfamily \#define Vector\+Insert(\begin{DoxyParamCaption}\item[{}]{X,  }\item[{}]{index,  }\item[{}]{x }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{        size\_t v\_tmp\_index\_ = (index); \(\backslash\)}
\DoxyCodeLine{        VectorReserve((X), (X).size + 1); \(\backslash\)}
\DoxyCodeLine{        memmove((X).ptr + v\_tmp\_index\_ + 1, (X).ptr + v\_tmp\_index\_, ((X).size -\/ v\_tmp\_index\_) * \textcolor{keyword}{sizeof}((X).ptr[0])); \(\backslash\)}
\DoxyCodeLine{        (X).ptr[v\_tmp\_index\_] = (x); \(\backslash\)}
\DoxyCodeLine{        (X).size++; \(\backslash\)}
\DoxyCodeLine{    \} \textcolor{keywordflow}{while} (0)}

\end{DoxyCode}
Inserts an element x at the specified index of the vector X. The index must be 0 $<$= index $<$ \mbox{\hyperlink{vector_8h_a62677f923a531566c4bc9d0201e61cc3}{Vector\+Size(\+X)}}.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
{\em index} & the position at which the element will be inserted. \\
\hline
{\em x} & the element to be inserted. \\
\hline
\end{DoxyParams}


Definition at line 330 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_afe4b00b95a6f121c7a2774decd594bd0}\label{vector_8h_afe4b00b95a6f121c7a2774decd594bd0}} 
\index{vector.h@{vector.h}!VectorInserts@{VectorInserts}}
\index{VectorInserts@{VectorInserts}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorInserts}{VectorInserts}}
{\footnotesize\ttfamily \#define Vector\+Inserts(\begin{DoxyParamCaption}\item[{}]{X,  }\item[{}]{index,  }\item[{}]{src,  }\item[{}]{n }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{        size\_t v\_tmp\_index\_ = (index), v\_tmp\_n\_ = (n); \(\backslash\)}
\DoxyCodeLine{        VectorReserve((X), (X).size + v\_tmp\_n\_); \(\backslash\)}
\DoxyCodeLine{        memmove((X).ptr + v\_tmp\_index\_ + v\_tmp\_n\_, (X).ptr + v\_tmp\_index\_, ((X).size -\/ v\_tmp\_index\_) * \textcolor{keyword}{sizeof}((X).ptr[0])); \(\backslash\)}
\DoxyCodeLine{        memcpy((X).ptr + v\_tmp\_index\_, (src), v\_tmp\_n\_ * \textcolor{keyword}{sizeof}((X).ptr[0])); \(\backslash\)}
\DoxyCodeLine{        (X).size += v\_tmp\_n\_; \(\backslash\)}
\DoxyCodeLine{    \} \textcolor{keywordflow}{while} (0)}

\end{DoxyCode}
Inserts an n elements of src at the specified index of the vector X. The index must be 0 $<$= index $<$ \mbox{\hyperlink{vector_8h_a62677f923a531566c4bc9d0201e61cc3}{Vector\+Size(\+X)}}.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
{\em index} & the position at which the elements will be inserted. \\
\hline
{\em src} & the starting address of the buffer storing elements to be inserted. \\
\hline
{\em n} & the number of elements to be inserted. \\
\hline
\end{DoxyParams}


Definition at line 353 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a13c01eebcaab19947f96d1e1af0df64a}\label{vector_8h_a13c01eebcaab19947f96d1e1af0df64a}} 
\index{vector.h@{vector.h}!VectorErase@{VectorErase}}
\index{VectorErase@{VectorErase}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorErase}{VectorErase}}
{\footnotesize\ttfamily \#define Vector\+Erase(\begin{DoxyParamCaption}\item[{}]{X,  }\item[{}]{index }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{        size\_t v\_tmp\_index\_ = (index); \(\backslash\)}
\DoxyCodeLine{        memmove((X).ptr + v\_tmp\_index\_, (X).ptr + v\_tmp\_index\_ + 1, ((X).size -\/ v\_tmp\_index\_ -\/ 1) * \textcolor{keyword}{sizeof}((X).ptr[0])); \(\backslash\)}
\DoxyCodeLine{        (X).size-\/-\/; \(\backslash\)}
\DoxyCodeLine{    \} \textcolor{keywordflow}{while} (0)}

\end{DoxyCode}
Removes an element at the specified index of the vector X. The index must be 0 $<$= index $<$ \mbox{\hyperlink{vector_8h_a62677f923a531566c4bc9d0201e61cc3}{Vector\+Size(\+X)}}.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
{\em index} & the position of the element to be removed. \\
\hline
\end{DoxyParams}


Definition at line 374 of file vector.\+h.

\mbox{\Hypertarget{vector_8h_a2202cc8095f318cc2d6db10ba93dcb92}\label{vector_8h_a2202cc8095f318cc2d6db10ba93dcb92}} 
\index{vector.h@{vector.h}!VectorErases@{VectorErases}}
\index{VectorErases@{VectorErases}!vector.h@{vector.h}}
\doxysubsubsection{\texorpdfstring{VectorErases}{VectorErases}}
{\footnotesize\ttfamily \#define Vector\+Erases(\begin{DoxyParamCaption}\item[{}]{X,  }\item[{}]{index,  }\item[{}]{n }\end{DoxyParamCaption})}

{\bfseries Value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{keywordflow}{do} \{ \(\backslash\)}
\DoxyCodeLine{        size\_t v\_tmp\_index\_ = (index), v\_tmp\_n\_ = (n); \(\backslash\)}
\DoxyCodeLine{        memmove((X).ptr + v\_tmp\_index\_, (X).ptr + v\_tmp\_index\_ + v\_tmp\_n\_, ((X).size -\/ v\_tmp\_index\_ -\/ 1) * \textcolor{keyword}{sizeof}((X).ptr[0])); \(\backslash\)}
\DoxyCodeLine{        (X).size -\/= v\_tmp\_n\_; \(\backslash\)}
\DoxyCodeLine{    \} \textcolor{keywordflow}{while} (0)}

\end{DoxyCode}
Removes an n elements at the specified index of the vector X. The index must be 0 $<$= index $<$ \mbox{\hyperlink{vector_8h_a62677f923a531566c4bc9d0201e61cc3}{Vector\+Size(\+X)}} -\/ n + 1.


\begin{DoxyParams}{Parameters}
{\em X} & the vector object. \\
\hline
{\em index} & the starting position of the elements to be removed. \\
\hline
{\em n} & the number of elements to be removed. \\
\hline
\end{DoxyParams}


Definition at line 394 of file vector.\+h.

