18.01.2011 22:25, Andrei Alexandrescu пишет:
I implemented a simple separatorless joiner as follows:
...
The code has a few properties that I'd like to discuss a bit:
2. joiner uses an idiom that I've experimented with in the past: it
defines a local struct and returns it. As such, joiner's type is
impossible to express without auto. I find that idiom interesting for
many reasons, among which the simplest is that the code is terse,
compact, and doesn't pollute the namespace. I'm thinking we should do
the same for Appender - it doesn't make much sense to create an
Appender except by calling the appender() function.
I somewhat disagree about Appender. I had situations when I needed to
store an Appender as a class/struct member (i.e. one may build an output
range on top of it). Appender!T looks better than
ReturnType!(appender!T()), IMHO. Of course, one could always alias that
ReturnType, so it's not *that* much of a problem.