<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hi Dick,</div><div class=""><br class=""></div><div class="">I disagree. It should be restricted to PTRDIFF_MAX if you want to be compliant with any C++11 compiler.</div><div class=""><br class=""></div><div class="">If the difference of the 2 pointers does not fit into std::ptrdiff_t, you run into undefined behaviour. Nevertheless, I am quite sure most compilers will give the “expected result” for static_cast<std::size_t>(end_ - begin_). But it should be considered as luck, not as something certified by the standard.</div><div class=""><br class=""></div><div class="">François</div><div class=""><br class=""></div><div class=""><br class=""></div><div><blockquote type="cite" class=""><div class="">On 17 Feb 2015, at 17:28, Richard Hadsell <<a href="mailto:hadsell@blueskystudios.com" class="">hadsell@blueskystudios.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">
<meta content="text/html; charset=windows-1252" http-equiv="Content-Type" class="">
<div bgcolor="#FFFFFF" text="#000000" class="">
However, the end pointer can never be less than the begin pointer,
so you can safely cast the ptrdiff_t result to size_t. Restricting
it to PTRDIFF_MAX seems unnecessarily restrictive.<div class="moz-signature">
<pre class="moz-signature" cols="256">Dick Hadsell 203-992-6320 Fax: 203-992-6001
Reply-to: <a class="moz-txt-link-abbreviated" href="mailto:hadsell@blueskystudios.com">hadsell@blueskystudios.com</a>
Blue Sky Studios <a class="moz-txt-link-freetext" href="http://www.blueskystudios.com/">http://www.blueskystudios.com</a>
1 American Lane, Greenwich, CT 06831-2560
</pre>
</div>
</div>
</div></blockquote></div><br class=""></body></html>