<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-01-09 19:16 GMT+01:00 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br class="m_7262095778456847478gmail_msg"><br class="m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478gmail_msg"><span class=""><div dir="ltr" class="m_7262095778456847478gmail_msg">On Mon, Jan 9, 2017 at 10:10 AM Piotr Padlewski <<a href="mailto:piotr.padlewski@gmail.com" class="m_7262095778456847478gmail_msg" target="_blank">piotr.padlewski@gmail.com</a>> wrote:<br class="m_7262095778456847478gmail_msg"></div><blockquote class="gmail_quote m_7262095778456847478gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="m_7262095778456847478gmail_msg"><div class="gmail_extra m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478gmail_msg">2017-01-09 17:24 GMT+01:00 David Blaikie <span dir="ltr" class="m_7262095778456847478gmail_msg"><<a href="mailto:dblaikie@gmail.com" class="m_7262095778456847478gmail_msg" target="_blank">dblaikie@gmail.com</a>></span>:<br class="m_7262095778456847478gmail_msg"><blockquote class="gmail_quote m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478gmail_msg"><br class="m_7262095778456847478gmail_msg"><br class="m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478gmail_msg"><span class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail- m_7262095778456847478gmail_msg"><div dir="ltr" class="m_7262095778456847478gmail_msg">On Mon, Jan 9, 2017 at 6:17 AM Piotr Padlewski via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="m_7262095778456847478gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br class="m_7262095778456847478gmail_msg"></div><blockquote class="gmail_quote m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Are there any other comments about changing style guide?<div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">I would like to add points like</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- prefer "using' instead of "typedef"</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- use default member initialization</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">struct A {</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"> void *ptr = nullptr;</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">};</div></div></blockquote><blockquote class="gmail_quote m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">(instead of doing it in constructor)</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- use default, override, delete</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- skip "virtual" with override</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">The last point is to get to consensus with </div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">push_back({first, second}) </div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">or</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">emplace_back(first ,second);</div></div></blockquote></span><div class="m_7262095778456847478gmail_msg"><br class="m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605inbox-inbox-Apple-interchange-newline m_7262095778456847478gmail_msg">It might be a bit noisy, but I'd be inclined to start a separate thread for each of these on llvm-dev with a clear subject line relevant to each one. So they don't get lost and some of them don't get drowned out by the discussion of others, etc.<br class="m_7262095778456847478gmail_msg"> </div></div></div></blockquote></div></div></div><div dir="ltr" class="m_7262095778456847478gmail_msg"><div class="gmail_extra m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478gmail_msg"><div class="m_7262095778456847478gmail_msg">Sure, I can do it, but at least now I don't see much of attention of people to any of the subject, so I would not like to start 5 empty threads.</div><div class="m_7262095778456847478gmail_msg">I guess as long as the thread is not getting noisy I will keep only one. Does it sound ok?</div></div></div></div></blockquote></span><div><br>Perhaps - if no one else pipes up *shrug*<br><br>If that's the case, I'd at least suggest submitting the changes to the style guide separately with clear subject/titles so people reading commits might see/notice/discuss there.<br><br></div></div></div></blockquote><div>Good idea.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote m_7262095778456847478gmail_msg"><div>FWIW: I'm also in favor of push_back where valid. Though I'm not sure it's so much a matter of votes, but justification, etc. As for the others - sure, they all sound good to me.<br><br></div></div></div></blockquote><div>I totally agree with all the points Chandler pointed out except the 2.b (multiple or no arugments). I just prefer emplace_back, but I find the push_back({}) also clean. So I guess small voting would be a good way to figure out what people prefer here.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote m_7262095778456847478gmail_msg"><div>Also - once these are in the style guide there's still a separate discussion to be had about whether automated cleanup is worthwhile & how best to go about that sort of thing.<br> </div></div></div></blockquote><div>That's right, I am not proposing any automatic cleanups (yet).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote m_7262095778456847478gmail_msg"><div><div class="h5"><blockquote class="gmail_quote m_7262095778456847478gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="m_7262095778456847478gmail_msg"><div class="gmail_extra m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478gmail_msg"><div class="m_7262095778456847478gmail_msg"><br class="m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478gmail_msg"> </div><blockquote class="gmail_quote m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478gmail_msg"><blockquote class="gmail_quote m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="m_7262095778456847478gmail_msg"><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-h5 m_7262095778456847478gmail_msg"><div class="gmail_extra m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">2016-12-30 12:26 GMT+01:00 Piotr Padlewski <span dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><<a href="mailto:piotr.padlewski@gmail.com" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" target="_blank">piotr.padlewski@gmail.com</a>></span>:<br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><blockquote class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="gmail_extra m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><span class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">2016-12-30 11:34 GMT+01:00 Chandler Carruth <span dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><<a href="mailto:chandlerc@gmail.com" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" target="_blank">chandlerc@gmail.com</a>></span>:<br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><blockquote class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><span class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail- m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">On Fri, Dec 30, 2016 at 2:08 AM Piotr Padlewski via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><blockquote class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Thanks for very accurate responses.<div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- I totally agree what Dave and Chandler said about explicit and implicit operations, this is what I meant my first email.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"> I believe there are places like </div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"> v.emplace_back(A, B);</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"> istead of</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"> v.push_back(make_pair(A, B));b</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"> That can make code simpler.</div></div></blockquote><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div></span><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Do you have examples? The only ones i can come up with are the ones where the push_back variant literally can't compile because the type isn't movable.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Perhaps it would be useful to break down categories of can happen here...</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Case 1: there is one object already -- this is a *conversion* of a type.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- If the author of the conversion made it *implicit*, then 'v.push_back(x)' just works.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- If the author of the conversion made it *explicit* I would like to see the name of the type explicitly: 'v.push_back(T(x))'.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div></div></div></blockquote><blockquote class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Case 2a: There is a collection of objects that are being composed into an aggregate. We don't have any interesting logic in the constructor, it takes an initializer list.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- This should work with 'v.push_back({a, b, c})'</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- If it doesn't today, we can fix the type's constructors so that it does.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- Using 'emplace_back' doesn't help much -- you still need {}s to form the std::initializer_list in many cases. Pair and tuple are somewhat unusual in not requiring them.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div></div></div></blockquote></span><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"> This sounds extremely reasonable. </div><span class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><blockquote class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Case 2b: A specific constructor needs to be called with an argument list. These arguments are not merely being aggregated but are inputs to a constructor that contains logic.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- This is analogous to a case called out w.r.t. '{...}' syntax in the coding standards[1]</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- Similar to that rule, I would like to see a *call to the constructor* rather than hiding it behind 'emplace_back' as this is a function with interesting logic.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- That means i would write T(a, b, c) anyways, and 'v.push_back(T(a, b, c))' works.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div></div></div></blockquote></span><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Calling emplace_back with 0 or multiple arguments is a clear way of saying "this constructor takes multiple arguments".</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">We can do it with initializer list with easy way like:</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><font face="monospace, monospace" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">v.emplace_back() == v.push_back({})</font></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><font face="monospace, monospace" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">v.emplace_back(a, b ,c) == v.push_back({a, b, c})</font></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">I personally never liked the initializer syntax because of tricky casees like:</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><font face="monospace, monospace" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">vector<string> v{{"abc", "def"}};</font><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Which is equivalent of </div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><font face="monospace, monospace" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">vector<string> v = {std::string("abc", "def")};</font><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">That will call std::string ctor with 2 iterators likely crashing, and putting same string might gives us empty string.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">In this case programmer probably meant</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><font face="monospace, monospace" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">std::vector<std:string> v({"abc", "def"});</font><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">or</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><font face="monospace, monospace" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">std::vector<std::string> v = {"abc", "def"};</font><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">But this case is not possible to mess up with push_back (in the case of vector<vector<string>> or something). At least I hope it is not.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">So avoiding braces is my personal preference. It is fine for me if we would choose to prefer '<font face="monospace, monospace" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">v.push_back({a, b, c})</font>' instead of '<font face="monospace, monospace" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">v.emplace_back(a, b, c)</font>', ofc as long as most of the community would prefer first form to the second :)</div><span class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><blockquote class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">[1]: <a href="http://llvm.org/docs/CodingStandards.html#do-not-use-braced-initializer-lists-to-call-a-constructor" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" target="_blank">http://llvm.org/docs/<wbr>CodingStandards.html#do-not-<wbr>use-braced-initializer-lists-<wbr>to-call-a-constructor</a></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Case 3: Passing objects of type 'T' through 'push_back' fails to compile because they cannot be copied or moved.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">- You *must* use 'emplace_back' here. No argument (obviously).</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">My experience with LLVM code and other codebases is that case 3 should be extremely rare. The intersection of "types that cannot be moved or copied" and "types that you put into containers" is typically small.</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Anyways, I don't disagree with this point with a tiny fix:</div><span class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail- m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><blockquote class="gmail_quote m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125m_-4391909161219543446gmail-m_-7306051220478311565gmail_msg m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"> I think in cases like this we can leave it for judgement of contributor.</div></div></blockquote></span><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">*or reviewer*. ;]</div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div><div class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">I continue to think exceptions can be made in rare cases when folks have good reasons. But I expect this to be quite rare. =]</div></div></div>
</blockquote></span></div><span class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125HOEnZb m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><font color="#888888" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></font></span></div><span class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605m_2315590147657139125HOEnZb m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><font color="#888888" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"><div class="gmail_extra m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">Piotr</div></font></span></div>
</blockquote></div><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg"></div></div></div><span class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail- m_7262095778456847478gmail_msg">
______________________________<wbr>_________________<br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">
cfe-dev mailing list<br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">
<a href="mailto:cfe-dev@lists.llvm.org" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" target="_blank">cfe-dev@lists.llvm.org</a><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br class="m_7262095778456847478m_-964398813434624145m_-1212777871862749204gmail-m_-9051830732298336605gmail_msg m_7262095778456847478gmail_msg">
</span></blockquote></div></div>
</blockquote></div></div></div></blockquote></div></div></div></div>
</blockquote></div><br></div></div>