\documentclass[a4paper]{article}
\usepackage{pgfplots}
\usepackage{amsmath}
\newif\ifdequetest

\begin{document}

\section{init}
\pgfplotsdequenewempty{test}\capacity{10}

Elements:

\pgfplotsdequeforeach{test}\as\cur{%
	Cur = \cur\par
}%

\section{filling: pushback}
\pgfplotsdequepushback 1\to{test}%
\pgfplotsdequepushback 2\to{test}%
\pgfplotsdequepushback 3\to{test}%

Elements:

\pgfplotsdequeforeach{test}\as\cur{%
	Cur = \cur\par
}%

\pgfplotsdequepushback 4\to{test}%
\pgfplotsdequepushback 5\to{test}%
\pgfplotsdequepushback 6\to{test}%
\pgfplotsdequepushback 7\to{test}%
\pgfplotsdequepushback 8\to{test}%
\pgfplotsdequepushback 9\to{test}%

Elements:

\pgfplotsdequeforeach{test}\as\cur{%
	Cur = \cur\par
}%

\section{popfront}
\pgfplotsdequepopfront{test}\to\front $\rightarrow$ \front\par
\pgfplotsdequepopfront{test}\to\front $\rightarrow$ \front\par
\pgfplotsdequepopfront{test}\to\front $\rightarrow$ \front\par


Elements:

\pgfplotsdequeforeach{test}\as\cur{%
	Cur = \cur\par
}%

\section{pushback}
\pgfplotsdequepushback10\to{test}%
\pgfplotsdequepushback11\to{test}%
\pgfplotsdequepushback12\to{test}%

Elements:

\pgfplotsdequeforeach{test}\as\cur{%
	Cur = \cur\par
}%

\section{popfront all}
\loop
\pgfplotsdequeifempty{test}{\dequetestfalse}{\dequetesttrue}%
\ifdequetest
	\pgfplotsdequepopfront{test}\to\front $\rightarrow$ \front;
\repeat
\end{document}

