<div dir="ltr">+1 for the feature test macro. What would the value of the macro be?<div><br></div><div>It's particularly important in this case because the availability of std::is_aggregate is dependent</div><div>on both the compiler version, because a builtin is required, and the STL version.<br></div><div><br></div><div>/Eric</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Mar 30, 2017 at 8:14 PM, Agustín Bergé <span dir="ltr"><<a href="mailto:agustinberge@gmail.com" target="_blank">agustinberge@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">LWG2911 gave us the new `is_aggregate` trait, but no feature-test macro.<br>
I would like to suggest `__cpp_lib_is_aggregate`. What follows is a<br>
motivational use case, courtesy of Jonathan Wakely:<br>
<br>
#include <vector><br>
template<typename T, typename... Args><br>
T make(Args&&... args)<br>
{<br>
#if __cpp_lib_is_aggregate<br>
if constexpr (std::is_aggregate_v<T>)<br>
return { std::forward<Args>(args)... };<br>
else<br>
#endif<br>
return T(std::forward<Args>(args)...)<wbr>;<br>
}<br>
struct Agg { int i; };<br>
int main()<br>
{<br>
auto v = make<std::vector<int>>(1, 2);<br>
#if __cpp_lib_is_aggregate<br>
// make<> only supports aggregates if std::is_aggregate is<br>
available<br>
auto a = make<Agg>(1);<br>
#endif<br>
}<br>
<br>
Regards,<br>
<span class="HOEnZb"><font color="#888888">--<br>
Agustín K-ballo Bergé<br>
<a href="http://talesofcpp.fusionfenix.com" rel="noreferrer" target="_blank">http://talesofcpp.fusionfenix.<wbr>com</a><br>
______________________________<wbr>_________________<br>
Features mailing list<br>
<a href="mailto:Features@isocpp.open-std.org">Features@isocpp.open-std.org</a><br>
<a href="http://www.open-std.org/mailman/listinfo/features" rel="noreferrer" target="_blank">http://www.open-std.org/<wbr>mailman/listinfo/features</a><br>
</font></span></blockquote></div><br></div>