title: C++: Intersection Of two ranges
body: <p>I'm trying to find the intersection of two ranges in C++? For example, if I have one range as [1..14] inclusive, and another as [10..20] inclusive, I want to get [10..14], as that is the intersection between them. </p>
  
  <p>I found a way on SO as follows :</p>
  
  <pre><code>intersection = { std::max(arg1.min, arg2.min), std::min(arg1.max, arg2.max) };
  if (intersection.max &lt; intersection.min) {
    intersection.markAsEmpty();
  }
  </code></pre>
  
  <p>I have few variables as follows :</p>
  
  <pre><code>unsigned long long int min1,min2,max1,max2 
  </code></pre>
  
  <p>for which I'm trying to find the the intersection. Then I did the following:</p>
  
  <pre><code>intersection = { std::max(min1, min2), std::min(max1, max2) };
      if (intersection.max &lt; intersection.min) {
        intersection.markAsEmpty();
      }
  </code></pre>
  
  <p>But this gives the error that unsigned long long int can't be used. How do I use it find the intersection ?</p>