title: What is the complexity of copying a variable in C++
body: <p>A friend of mine said that bitmasks are better than bitsets because it takes O(N) time to copy a bitset whereas only O(1) time to copy a bitmask, making it far faster for applications such as in Dynamic Programming. So I was wondering is it the same for all other data types?</p>
  
  <p>For eg what would be the complexity of this block of code?</p>
  
  <pre><code>vector &lt;int&gt; vec1 = {1,2,3,4,5,6,7,8,9,10};
  vector &lt;int&gt; vec2 = vec1;
  </code></pre>
  
  <p>If it is O(N), why is it so? Shouldn't it be O(1) just like doing something like</p>
  
  <pre><code>int x = 530210;
  int y = x;
  </code></pre>
  
  <p>would be?</p>