title: What is the best way to access deque's element in C++ STL
body: <p>I have a deque:</p>
  
  <pre><code>deque&lt;char&gt; My_Deque;
  My_Path.push_front('a');
  My_Path.push_front('b');
  My_Path.push_front('c');
  My_Path.push_front('d');
  My_Path.push_front('e');
  </code></pre>
  
  <p>There are such ways to output it.</p>
  
  <p>The first:</p>
  
  <pre><code>deque&lt;char&gt;::iterator It;
  for ( It = My_Deque.begin(); It != My_Deque.end(); It++ )
      cout &lt;&lt; *It &lt;&lt;  " ";
  </code></pre>
  
  <p>The second:</p>
  
  <pre><code>for (i=0;i&lt;My_Deque.size();i++) {
      cout &lt;&lt; My_Deque[i] &lt;&lt;  " ";
  }
  </code></pre>
  
  <p>What is the best way to access deque's element - through iterator or like this: <code>My_Deque[i]</code>?
  Has a deque&lt;...> element an array of pointers to each element for fast access to it's data or it provides access to it's random element in consequtive way (like on a picture below)?
  <img src="https://i.stack.imgur.com/6flPj.png" alt="enter image description here"> </p>