<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 3451: Inconsistently explicit deduction guides</title>
<meta property="og:title" content="Issue 3451: Inconsistently explicit deduction guides">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue3451.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p>
<h3 id="3451"><a href="lwg-active.html#3451">3451</a>. Inconsistently explicit deduction guides</h3>
<p><b>Section:</b> 27.4.3 <a href="https://wg21.link/basic.string">[basic.string]</a>, 25.7.14.2 <a href="https://wg21.link/range.join.view">[range.join.view]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Johel Ernesto Guerrero Pe&ntilde;a <b>Opened:</b> 2020-06-11 <b>Last modified:</b> 2020-07-17</p>
<p><b>Priority: </b>3
</p>
<p><b>View other</b> <a href="lwg-index-open.html#basic.string">active issues</a> in [basic.string].</p>
<p><b>View all other</b> <a href="lwg-index.html#basic.string">issues</a> in [basic.string].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
The library inconsistently marks deduction guides as <code>explicit</code>. <code>join_view</code> and <code>basic_string</code> 
account for the only two occurrences of unconditionally explicit deduction guides. All other deduction
guides have no <code>explicit</code>-specifier. Following is a list of unconditionally explicit constructors 
with their deduction guides.
</p>
<blockquote><pre>
template&lt;class Y&gt;
  explicit shared_ptr(const weak_ptr&lt;Y&gt;&amp; r);

template&lt;class T&gt;
  shared_ptr(weak_ptr&lt;T&gt;) -&gt; shared_ptr&lt;T&gt;;

template&lt;class T&gt;
  constexpr explicit basic_string(const T&amp; t, const Allocator&amp; a = Allocator());

template&lt;class charT,
         class traits,
         class Allocator = allocator&lt;charT&gt;&gt;
  explicit basic_string(basic_string_view&lt;charT, traits&gt;, const Allocator&amp; = Allocator())
    -&gt; basic_string&lt;charT, traits, Allocator&gt;;

explicit queue(const Container&amp;);
explicit queue(Container&amp;&amp;);

template&lt;class Container&gt;
  queue(Container) -&gt; queue&lt;typename Container::value_type, Container&gt;;

explicit stack(const Container&amp;);
explicit stack(Container&amp;&amp;);

template&lt;class Container&gt;
  stack(Container) -&gt; stack&lt;typename Container::value_type, Container&gt;;

constexpr explicit join_view(V base);

template&lt;class R&gt;
  explicit join_view(R&amp;&amp;) -&gt; join_view&lt;views::all_t&lt;R&gt;&gt;;

constexpr explicit common_view(V r);

template&lt;class R&gt;
  common_view(R&amp;&amp;) -&gt; common_view&lt;views::all_t&lt;R&gt;&gt;;

constexpr explicit reverse_view(V r);

template&lt;class R&gt;
  reverse_view(R&amp;&amp;) -&gt; reverse_view&lt;views::all_t&lt;R&gt;&gt;;


explicit zoned_time(TimeZonePtr z);
explicit zoned_time(string_view name);

template&lt;class TimeZonePtrOrName&gt;
  zoned_time(TimeZonePtrOrName&amp;&amp;)
    -&gt; zoned_time&lt;seconds, time-zone-representation&lt;TimeZonePtrOrName&gt;&gt;;

template&lt;class C&gt;
explicit stop_callback(const stop_token&amp; st, C&amp;&amp; cb)
    noexcept(is_nothrow_constructible_v&lt;Callback, C&gt;);
template&lt;class C&gt;
explicit stop_callback(stop_token&amp;&amp; st, C&amp;&amp; cb)
    noexcept(is_nothrow_constructible_v&lt;Callback, C&gt;);

template&lt;class Callback&gt;
  stop_callback(stop_token, Callback) -&gt; stop_callback&lt;Callback&gt;;
</pre></blockquote>

<p><i>[2020-07-17; Priority set to 3 in telecon]</i></p>



<p id="res-3451"><b>Proposed resolution:</b></p>
<p>This wording is relative to <a href="https://wg21.link/n4861">N4861</a>.</p>

<ol>
<li>
<p>Modify 27.4.3 <a href="https://wg21.link/basic.string">[basic.string]</a>, class template <code>basic_string</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
template&lt;class charT,
         class traits,
         class Allocator = allocator&lt;charT&gt;&gt;
  <del>explicit</del> basic_string(basic_string_view&lt;charT, traits&gt;, const Allocator&amp; = Allocator())
    -&gt; basic_string&lt;charT, traits, Allocator&gt;;
[&hellip;]
</pre>
</blockquote>
</li>

<li>
<p>Modify 27.4.3.3 <a href="https://wg21.link/string.cons">[string.cons]</a> as indicated:</p>

<blockquote>
<pre>
[&hellip;]
template&lt;class charT,
         class traits,
         class Allocator = allocator&lt;charT&gt;&gt;
  <del>explicit</del> basic_string(basic_string_view&lt;charT, traits&gt;, const Allocator&amp; = Allocator())
    -&gt; basic_string&lt;charT, traits, Allocator&gt;;
[&hellip;]
</pre>
<blockquote>
<p>
-22- <i>Constraints:</i> <code>Allocator</code> is a type that qualifies as an allocator (23.2.2 <a href="https://wg21.link/container.requirements.general">[container.requirements.general]</a>).
</p>
</blockquote>
</blockquote>
</li>

<li>
<p>Modify 25.7.14.2 <a href="https://wg21.link/range.join.view">[range.join.view]</a>, class template <code>join_view</code> synopsis, as indicated:</p>

<blockquote>
<pre>
[&hellip;]
template&lt;class R&gt;
  <del>explicit</del> join_view(R&amp;&amp;) -&gt; join_view&lt;views::all_t&lt;R&gt;&gt;;
[&hellip;]
</pre>
</blockquote>
</li>
</ol>




</body>
</html>
