title: How to fill the data or access a 3-dimensional vector in C++
body: <p>I am implementing a 2-Dimensional Neuron Network on Windows, Visual Studio 2015.</p>
  
  <p><img src="https://camo.githubusercontent.com/35792b45e2934b05f343ca3e4de5a0c9144381b3/68747470733a2f2f7261772e6769746875622e636f6d2f6461766964726d696c6c65722f6e657572616c32642f6d61737465722f696d616765732f6e65742d3578352d3478342d322d736d2e706e67" alt="2-D Neuron Network"></p>
  
  <p>Picture is from Dave Miller blog <a href="https://github.com/davidrmiller/neural2d#2D" rel="nofollow">https://github.com/davidrmiller/neural2d#2D</a></p>
  
  <p>I have a topology variable, which is the structure of the network => therefore it's the 3-dimensional vector of Neurons exactly like the picture above.</p>
  
  <p>my topology is a vector of Layers:</p>
  
  <pre><code>typedef vector&lt;vector&lt;Neuron&gt;&gt; Layer; // this is written outside main()
  vector&lt;Layer&gt; topology;               // this is within main()
  </code></pre>
  
  <p>then, in my main(), I create the test topology with an example layers to test my Net class constructor:</p>
  
  <pre><code>int main()
  {
  // test topology {3x3,2x2,2}
  vector&lt;Layer&gt; topology;
  Layer L0 [3][3]; 
  Layer L1 [2][2]; 
  Layer L2 [1][2]; 
  
  topology.push_back(L0);
  topology.push_back(L1);
  topology.push_back(L2);
  
  
  Net myNet(topology); // create the network
  
  
  return 0;
  }
  </code></pre>
  
  <p>To test my Net constructor, I will {cout} the letter 'k' on each creation of a new Neuron:</p>
  
  <pre><code>class Net
  {
   public:
   Net(vector&lt;Layer&gt; topology) // constructor
   {
      // Create the Layers and fill it with neurons
      for (int LayersNumber = 0; LayersNumber &lt; topology.size(); LayersNumber++)  //(0 is the input layer, last is output, rest are the hidden)
      {
          m_layers.push_back(Layer()); // add a 2-d layer
  
          for (int NeuronRow = 0; NeuronRow &lt; topology[LayersNumber].size(); NeuronRow++) // fill the layer with Neurons
          {
              m_layers.back().push_back(vector&lt;Neuron&gt;(0)); // add a vector of Neurons on the new 2-d layer (using .back())
  
              for (int NeuronColumn = 0; NeuronColumn &lt;= topology[LayersNumber][NeuronRow].size(); NeuronColumn++) // &lt;= for the Bias Neuron
              {
                  m_layers[LayersNumber].back().push_back(Neuron()); // add a Neuron
              // m_layers[LayerNum][NeuronRow]{NeuronColumn]
  
                  cout &lt;&lt; "K" &lt;&lt; endl; // display test
  
              }
          }
  
      }
  
  };
  </code></pre>
  
  <p>For some reason I have an error in my main() on the .push_back function calls. It says arguments don't match the argument type. I couldn't figure it out. </p>
  
  <p>I appreciate any help. Thanks in advance</p>