title: how to std::sort a 3 dimensional vector
body: <p>I have a vector declared as follow : </p>
  
  <pre><code>vector&lt;vector&lt;vector&lt;int&gt; &gt; &gt; myVector (148995,vector&lt;vector&lt;int&gt; &gt;(7,vector &lt;int&gt;(6,0)));
  </code></pre>
  
  <p>I would like to be able to use std::sort to sort it.</p>
  
  <p>I want to sort all the value of y by the value of y = 5 in Myvector[x][y][z] </p>
  
  <p>I would like to be able to sort one z at a time (z value can be from 0 to 5 ), i have tried to sort it as an independent 2d vector and only have Myvector[x][y] but I always get compile error while doing so.</p>
  
  <p>I have found this code on another stackoverflow question that works for 2d vector but my limited programming skills do not let me convert it for a 3d vector : </p>
  
  <pre><code>std::sort(myVector.begin(), myVector.end(), [](const std::vector&lt; int &gt;&amp; a, const std::vector&lt; int &gt;&amp; b){ return a[1] &gt; b[1]; } );
  </code></pre>
  
  <p>thank you,
  Kaven</p>
  
  <p><strong>edit</strong></p>
  
  <pre><code>myVector[x][y][z]
  Myvector[x] = {0,1,2,3,...,200 000}
  myvector[0][y][0] = {44,30,21,15,1,600,25} 
  myvector[1][y][0] = [25,24,10,7,1,700,30}
  myvector[0][y][2] = {34,20,11,6,1,400,25} 
  myvector[1][y][2] = [33,24,10,7,1,300,40}
  </code></pre>
  
  <p>if i would sort myvector[x][y][z] for all x by the value of y = 5 and sort all 'y' values where z = 0 (z can change from 0 to 5)</p>
  
  <p>if i were to use the sort i would like and use it on z = 0 
  i would get </p>
  
  <pre><code>myvector[1][y][0] = {44,30,21,15,1,600,25} 
  myvector[0][y][0] = [25,24,10,7,1,700,30}
  myvector[0][y][2] = {34,20,11,6,1,400,25} 
  myvector[1][y][2] = [33,24,10,7,1,300,40}
  </code></pre>