Ahh, UDLs also wouldn't permit non literal format strings, which is a deal breaker imo<br><div class="gmail_quote"><div dir="ltr">On Wed, Oct 12, 2016 at 7:03 AM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm not sure that would work well.  The implementation relies on being able to index into the parameter pack.  How would you do that if each parameter is streamed in?<br class="gmail_msg"><br class="gmail_msg">"{0} {1}"_fs(1, 2)<br class="gmail_msg"><br class="gmail_msg">Could perhaps work, but it looks a little strange to me.<br class="gmail_msg"><br class="gmail_msg">Fwiw i agree format_string is long.  Ideally it would be called format, but that's taken.<br class="gmail_msg"><br class="gmail_msg">Another option is os.format("{0}", 7), and have format_string("{0}", 7) return a std::string.<br class="gmail_msg"><div class="gmail_quote gmail_msg"><div dir="ltr" class="gmail_msg">On Wed, Oct 12, 2016 at 6:43 AM Aaron Ballman <<a href="mailto:aaron@aaronballman.com" class="gmail_msg" target="_blank">aaron@aaronballman.com</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">>> 1. os << format_string("Test");   // writes "test"<br class="gmail_msg">
>> 2. os << format_string("{0}", 7);  // writes "7"<br class="gmail_msg">
><br class="gmail_msg">
><br class="gmail_msg">
> The "<< format_string(..." is ... really verbose for me. It also makes me<br class="gmail_msg">
> strongly feel like this produces a string rather than a streamable entity.<br class="gmail_msg">
<br class="gmail_msg">
I wonder if we could use UDLs instead?<br class="gmail_msg">
<br class="gmail_msg">
os << "Test" << "{0}"_fs << 7;<br class="gmail_msg">
<br class="gmail_msg">
~Aaron<br class="gmail_msg">
<br class="gmail_msg">
><br class="gmail_msg">
> I'm not a huge fan of streaming, but if we want to go this route, I'd very<br class="gmail_msg">
> much like to keep the syntax short and sweet. "format" is pretty great for<br class="gmail_msg">
> that. If this is going to fully subsume its use cases, can we eventually get<br class="gmail_msg">
> that to be the name?<br class="gmail_msg">
><br class="gmail_msg">
> (While I don't like streaming, I'm not trying to fight that battle here...)<br class="gmail_msg">
><br class="gmail_msg">
> Also, you should probably look at what is quickly becoming a popular C++<br class="gmail_msg">
> library in this space: <a href="https://github.com/fmtlib/fmt" rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/fmtlib/fmt</a><br class="gmail_msg">
><br class="gmail_msg">
> _______________________________________________<br class="gmail_msg">
> LLVM Developers mailing list<br class="gmail_msg">
> <a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="gmail_msg">
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="gmail_msg">
><br class="gmail_msg">
</blockquote></div></blockquote></div>