Yea, the main reason is because this pattern could be used to allow conversion even to types we don't control, like set or deque.  Also a range constructor might be confusing since many containers use a single argument constructor to indicate the initial size (SFINAE would make it work, but I like to avoid it when possible to make the code easier to understand)<br><div class="gmail_quote"><div dir="ltr">On Sun, Mar 12, 2017 at 10:52 PM David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br class="gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Sun, Mar 12, 2017, 10:49 PM Chandler Carruth via Phabricator <<a href="mailto:reviews@reviews.llvm.org" class="gmail_msg" target="_blank">reviews@reviews.llvm.org</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">chandlerc added inline comments.<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
================<br class="gmail_msg">
Comment at: llvm/include/llvm/ADT/STLExtras.h:891-897<br class="gmail_msg">
+/// \brief Given a range of type R, iterate the entire range and return a<br class="gmail_msg">
+/// SmallVector with elements of the vector.  This is useful, for example,<br class="gmail_msg">
+/// when you want to iterate a range and then sort the results.<br class="gmail_msg">
+template <unsigned Size, typename R><br class="gmail_msg">
+SmallVector<detail::ValueOfRange<R>, Size> to_vector(R &&Range) {<br class="gmail_msg">
+  return {std::begin(Range), std::end(Range)};<br class="gmail_msg">
+}<br class="gmail_msg">
----------------<br class="gmail_msg">
Why not a range constructor for SmallVector?<br class="gmail_msg"></blockquote></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Fair, I wouldn't mind that. But I did check and std::vector doesn't have one I don't think, so I figured for consistency and that this could grow to allow other kinds of ranges to be constructed.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="gmail_msg">
<br class="gmail_msg">
<a href="https://reviews.llvm.org/D30853" rel="noreferrer" class="gmail_msg" target="_blank">https://reviews.llvm.org/D30853</a><br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
</blockquote></div>
</blockquote></div>