title: C++ access set via iterator
body: <p>I have the following code:</p>
  
  <pre><code>struct voxel
  {
      int x, y, z;
  };
  std::set&lt;std::set&lt;voxel&gt;&gt; regions;
  
  std::set&lt;std::set&lt;voxel&gt;&gt;::iterator regions_it;
  std::set&lt;voxel&gt;::iterator voxel_it;
  for (regions_it = regions.begin(); regions_it != regions.end(); regions_it++){
      for (voxel_it = regions_it-&gt;begin(); voxel_it != regions_it-&gt;end; voxel_it++){
           if (condition){
               struct voxel v = { 1, 2, 3 };
               regions_it-&gt;insert(v);
           }
      }
  }
  </code></pre>
  
  <p>Just assume that "condition" is a boolean. I have trouble specifically with <code>regions_it-&gt;insert(v)</code>. The arrow (->) is marked as error. I tried with <code>regions_it.insert(v)</code> but it doesn't work either.</p>
  
  <p><code>regions_it</code> should be a pointer that points to a set of voxels if I'm not mistaken, but how can I call the insert method?</p>
  
  <p>I'm still unfamiliar to C++. Would be nice if someone can help me out.</p>