<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 7 April 2017 at 15:30, Agustín Bergé <span dir="ltr">&lt;<a href="mailto:agustinberge@gmail.com" target="_blank">agustinberge@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 4/7/2017 7:17 PM, Richard Smith wrote:<br>
&gt; On 7 April 2017 at 15:00, Agustín Bergé &lt;<a href="mailto:agustinberge@gmail.com">agustinberge@gmail.com</a><br>
</span><span class="">&gt; &lt;mailto:<a href="mailto:agustinberge@gmail.com">agustinberge@gmail.com</a><wbr>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     On 4/7/2017 5:19 PM, Richard Smith wrote:<br>
&gt;     &gt; On 30 March 2017 at 19:14, Agustín Bergé &lt;<a href="mailto:agustinberge@gmail.com">agustinberge@gmail.com</a> &lt;mailto:<a href="mailto:agustinberge@gmail.com">agustinberge@gmail.com</a><wbr>&gt;<br>
</span><div><div class="h5">&gt;     &gt; &lt;mailto:<a href="mailto:agustinberge@gmail.com">agustinberge@gmail.com</a> &lt;mailto:<a href="mailto:agustinberge@gmail.com">agustinberge@gmail.com</a><wbr>&gt;&gt;&gt; wrote:<br>
&gt;     &gt;<br>
&gt;     &gt;     LWG2911 gave us the new `is_aggregate` trait, but no feature-test macro.<br>
&gt;     &gt;     I would like to suggest `__cpp_lib_is_aggregate`. What follows is a<br>
&gt;     &gt;     motivational use case, courtesy of Jonathan Wakely:<br>
&gt;     &gt;<br>
&gt;     &gt;          #include &lt;vector&gt;<br>
&gt;     &gt;          template&lt;typename T, typename... Args&gt;<br>
&gt;     &gt;          T make(Args&amp;&amp;... args)<br>
&gt;     &gt;          {<br>
&gt;     &gt;          #if __cpp_lib_is_aggregate<br>
&gt;     &gt;              if constexpr (std::is_aggregate_v&lt;T&gt;)<br>
&gt;     &gt;                  return { std::forward&lt;Args&gt;(args)... };<br>
&gt;     &gt;              else<br>
&gt;     &gt;          #endif<br>
&gt;     &gt;                  return T(std::forward&lt;Args&gt;(args)...)<wbr>;<br>
&gt;     &gt;          }<br>
&gt;     &gt;          struct Agg { int i; };<br>
&gt;     &gt;          int main()<br>
&gt;     &gt;          {<br>
&gt;     &gt;              auto v = make&lt;std::vector&lt;int&gt;&gt;(1, 2);<br>
&gt;     &gt;          #if __cpp_lib_is_aggregate<br>
&gt;     &gt;              // make&lt;&gt; only supports aggregates if std::is_aggregate is<br>
&gt;     &gt;     available<br>
&gt;     &gt;              auto a = make&lt;Agg&gt;(1);<br>
&gt;     &gt;<br>
&gt;     &gt;<br>
&gt;     &gt; What does the #else look like here? I&#39;m not yet seeing how this feature<br>
&gt;     &gt; test macro is useful.<br>
&gt;     &gt;<br>
&gt;     &gt;          #endif<br>
&gt;     &gt;          }<br>
&gt;<br>
&gt;     There is no #else form here, the example is depicting a program with<br>
&gt;     decreased functionality. A user of `make` that depends on the feature<br>
&gt;     simply uses it, and it results in a compilation error when the feature<br>
&gt;     is not present:<br>
&gt;<br>
&gt;          int main()<br>
&gt;          {<br>
&gt;              auto a = make&lt;Agg&gt;(1);<br>
&gt;          }<br>
&gt;<br>
&gt;     Whereas a user of `make` that does not depend on the feature simply does<br>
&gt;     not use it, and lack of support for the feature does not result in a<br>
&gt;     compilation error:<br>
&gt;<br>
&gt;          int main()<br>
&gt;          {<br>
&gt;              auto v = make&lt;std::vector&lt;int&gt;&gt;(1, 2);<br>
&gt;          }<br>
&gt;<br>
&gt;     The feature test macro is needed for the implementation of `make`, in<br>
&gt;     order to support both use cases.<br>
&gt;<br>
&gt;<br>
&gt; This &#39;make&#39; seems like a terrible idea, but you&#39;ve convinced me that<br>
&gt; people might make use of the feature test macro.<br>
<br>
</div></div>Perhaps we could improve the motivational example then, if needed?<br>
<br>
The end goal is not to replace initialization with library machinery,<br>
but to support aggregate initialization in `make_xxx`/`emplace`<br>
functions in which initialization is performed by the library on behalf<br>
of the user, without trapping on `std::initializer_list`.</blockquote><div><br></div><div>That still sounds like a terrible idea. C++ does not need yet another form of initialization. =) But that is not a topic for this list.</div><div><br></div><div>Bad idea or not, the above was the motivation for adding the trait, so I don&#39;t think we&#39;re going to get a better motivating usage example.</div></div></div></div>