title: Can span be constexpr?
body: <p>All the constructors of std::span are declared constexpr, however I can't seem to get any of them to work in a constexpr context. Uncommenting any of the constexpr below will result in a compilation error.</p>
  
  <pre><code>#include &lt;array&gt;
  #include &lt;span&gt;
  
  int main()
  {
      constexpr int carray[3] = { 0, 1, 2 };
      constexpr std::array&lt;int, 3&gt; array{ 0, 1, 2 };
      using S = std::span&lt;const int, 3&gt;;
  
      /*constexpr*/ S span1{ array.data(), 3 };
      /*constexpr*/ S span2{array.begin(), array.end()};
      /*constexpr*/ S span3{carray};
      /*constexpr*/ S span4{array};
  }
  </code></pre>
  
  <p>Is it in fact possible to create a constexpr span type, since it seems like constructors can never be evaluated at compile time when they have to initialize a pointer or reference?</p>