title: Compare smaller vector to bigger to check if it differs at the end of smaller
body: <p>We have two vectors of size that depends on runtime and need to check if they are equal - differ elements only after the end of smaller size vector. I used std::equal but the issue is that I need to find first which vector is of smaller size which leads to extra line of code :</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;iostream&gt;
  
  int main()
  {
    std::vector&lt;int&gt; a(1000, 3);
    std::vector&lt;int&gt; a1(100, 3);
  
    if(a.size() &gt; a1.size())
    {
      if(std::equal(a1.begin(), a1.end(), a.begin()))
      {
        std::cout &lt;&lt; "Same a gt a1" &lt;&lt; std::endl;
      }
    }
  
    if(a1.size() &gt; a.size())
    {
      if(std::equal(a.begin(), a.end(), a1.begin()))
      {
        std::cout &lt;&lt; "Same a1 gt a" &lt;&lt; std::endl;
      }
    }
  
    if(a1.size() == a.size())
    {
      if(std::equal(a.begin(), a.end(), a1.begin()))
      {
         std::cout &lt;&lt; "Same a = a1" &lt;&lt; std::endl;
      }
    }
  }
  </code></pre>
  
  <p>Can the code to compare two vectors or differ only at the end of smaller vector be improved?</p>