<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Ah, also the enable_if for same:<div class=""><br class=""></div><div class=""><div class=""></div></div><blockquote type="cite" class=""><div class=""><div class="">    template<class _Tp></div><div class="">        _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS</div><div class="">        basic_string(const _Tp& __t, size_type __pos, size_type __n,</div><div class="">                     const allocator_type& __a = allocator_type(),</div><div class="">                     typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type* = 0);</div></div></blockquote><div class=""><br class=""></div><div class="">(Even if it is a conforming extension, it's fairly user hostile.  Doesn't mean it's necessarily wrong, but...)</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 15, 2017, at 19:38, Duncan P. N. Exon Smith via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=us-ascii" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">I just started working on a patch to add #if guards, and the first interesting thing I found was the basic_string constructor:<div class=""><br class=""></div><div class=""><div class=""></div><blockquote type="cite" class=""><div class="">template <class _CharT, class _Traits, class _Allocator></div><div class="">template <class _Tp></div><div class="">basic_string<_CharT, _Traits, _Allocator>::basic_string(</div><div class="">             const _Tp& __t, size_type __pos, size_type __n, const allocator_type& __a,</div><div class=""><span class="Apple-tab-span" style="white-space:pre">                    </span> typename enable_if<__can_be_converted_to_string_view<_CharT, _Traits, _Tp>::value, void>::type *)</div><div class="">    : __r_(__second_tag(), __a)</div><div class="">{</div><div class=""><span class="Apple-tab-span" style="white-space:pre">      </span>__self_view __sv = __self_view(__t).substr(__pos, __n);</div><div class="">    __init(__sv.data(), __sv.size());</div><div class="">#if _LIBCPP_DEBUG_LEVEL >= 2</div><div class="">    __get_db()->__insert_c(this);</div><div class="">#endif</div><div class="">}</div></blockquote><div class=""><br class=""></div><div class="">I suppose the decision was made so that std::string could take advantage of it.</div><div class=""><br class=""></div><div class="">Is it a conforming extension?</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">On Jun 15, 2017, at 18:35, Eric Fiselier <<a href="mailto:eric@efcs.ca" class="">eric@efcs.ca</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">It *shouldn't* include <string_view>, that's a given.<div class=""><br class=""></div><div class="">IIRC, and Marshall would know better, I believe it was untenable to</div><div class="">maintain a version of <string> that didn't depend on <string_view> after making</div><div class="">the changes required for C++17.</div><div class=""><br class=""></div><div class="">However inspecting <string> now it does seem possible that the entanglement</div><div class="">is avoidable.Though it's also likely I'm just not seeing the whole picture. </div><div class=""><br class=""></div><div class="">/Eric</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Thu, Jun 15, 2017 at 6:42 PM, Duncan P. N. Exon Smith <span dir="ltr" class=""><<a href="mailto:dexonsmith@apple.com" target="_blank" class="">dexonsmith@apple.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class=""><br class="">
> On Jul 20, 2016, at 22:31, Marshall Clow via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a>> wrote:<br class="">
><br class="">
> Modified: libcxx/trunk/include/string<br class="">
> URL: <a href="http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=276238&r1=276237&r2=276238&view=diff" rel="noreferrer" target="_blank" class="">http://llvm.org/viewvc/llvm-<wbr class="">project/libcxx/trunk/include/<wbr class="">string?rev=276238&r1=276237&<wbr class="">r2=276238&view=diff</a><br class="">
> ==============================<wbr class="">==============================<wbr class="">==================<br class="">
><br class="">
</span><span class="">> @@ -435,6 +461,7 @@ basic_string<char32_t> operator "" s( co<br class="">
> */<br class="">
><br class="">
> #include <__config><br class="">
> +#include <string_view><br class="">
<br class="">
</span>This breaks the following, valid, C++14 code:<br class="">
<br class="">
    #include <string><br class="">
    #include <experimental/string_view><br class="">
    using namespace std;<br class="">
    using std::experimental::string_<wbr class="">view;<br class="">
    void f() { string_view sv; }<br class="">
<br class="">
Should <string> #include <string_view> even when we're not in C++17 mode?  Why?<br class="">
<div class="HOEnZb"><div class="h5"><br class="">
> #include <iosfwd><br class="">
> #include <cstring><br class="">
> #include <cstdio>  // For EOF.<br class="">
<br class="">
</div></div></blockquote></div><br class=""></div>
</div></blockquote></div><br class=""></div></div>_______________________________________________<br class="">cfe-commits mailing list<br class=""><a href="mailto:cfe-commits@lists.llvm.org" class="">cfe-commits@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits<br class=""></div></blockquote></div><br class=""></div></body></html>