title: How can std::vector be converted to std::span?
body: <p>In the docs on <a href="https://en.cppreference.com/w/cpp/container/span/span" rel="noreferrer">std::span constructors</a>, there isn't one that accepts an std::vector.</p>
  <p>Then, how come this code (<a href="https://www.modernescpp.com/index.php/c-20-std-span" rel="noreferrer">source page</a>) compiles?</p>
  <pre><code>// createSpan.cpp
  
  #include &lt;algorithm&gt;
  #include &lt;iostream&gt;
  #include &lt;span&gt;
  #include &lt;vector&gt;
  
  int main() {
  
      std::cout &lt;&lt; std::endl;
      std::cout &lt;&lt; std::boolalpha;
  
      std::vector myVec{1, 2, 3, 4, 5};
      
      std::span mySpan1{myVec};                                        // (1)
      std::span mySpan2{myVec.data(), myVec.size()};                   // (2)
      
      bool spansEqual = std::equal(mySpan1.begin(), mySpan1.end(),
                                   mySpan2.begin(), mySpan2.end());
      
      std::cout &lt;&lt; &quot;mySpan1 == mySpan2: &quot; &lt;&lt; spansEqual &lt;&lt; std::endl;  // (3)
  
      std::cout &lt;&lt; std::endl;
      
  }
  </code></pre>
  <p>i.e. which constructor of std::span was invoked at (1)?</p>