title: Why is std::ssize() introduced in C++20?
body: <p><a href="https://en.wikipedia.org/wiki/C%2B%2B20" rel="noreferrer">C++20</a> introduced the <code>std::ssize()</code> free function as below:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>template &lt;class C&gt;
      constexpr auto ssize(const C&amp; c)
          -&gt; std::common_type_t&lt;std::ptrdiff_t,
                                std::make_signed_t&lt;decltype(c.size())&gt;&gt;;
  </code></pre>
  
  <p>A possible implementation seems using <code>static_cast</code>, to convert the return value of the <code>size()</code> member function of cl<em>ass C</em> into its signed counterpart.</p>
  
  <p>Since the <code>size()</code> member function of C always returns non-negative values, why would anyone want to store them in signed variables? In case one really wants to, it is a matter of simple <code>static_cast</code>. </p>
  
  <p>Why is <code>std::ssize()</code> introduced in C++20?</p>