title: Accessing variables in lambda without capture list
body: <p>I wonder why I can use global variables (thanks to Chris Drew for correcting me) in lamdas and why I don't need to capture them:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;vector&gt;
  using namespace std;
  
  size_t i = 0;
  vector&lt;int&gt; v = {1,2,3};
  
  int main()
  {
      auto lambda = [](){i = v.size();};
      lambda();
      cout &lt;&lt; i &lt;&lt; endl;
  
      return EXIT_SUCCESS;
  }
  </code></pre>
  
  <p>In this minimum working example I am accessing the size_t and the vector without capturing them. I would have to if they were declared inside the main-method. Why is that so and how can I copy the size_t and the vector? I tried to use <code>[=]</code> as capture list but it does not copy <code>v</code> and <code>i</code>.</p>