
On Thu, Jan 26, 2017 at 10:41 AM, Hans Dembinski <hans.dembinski@gmail.com> wrote:
Note that I am still resisting the idea of .str() as a member function. If the joiner or concatenation object exports begin() and end(), it's un-necessary, because the object returned by create_string() (or similar) can use the iterators.
I like that idea, though I still don't like the name to_string().
How about this:
auto s = generate<std::sting>(concat(...)); auto ws = generate<std::wsting>(concat(...));
Why don't you add explicit conversion operators to the string factory
explicit operator std::string() { … } explicit operator std::wstring() { … }
explicit type conversion was exactly added for this situation in C++11. The call is then
auto s = static_cast<std::string>(concat(…));
etc.
Otherwise I don't care if you add .str() or .to_string() members. I would prefer writing
auto s = concat(…).str();
over
auto s = static_cast<std::string>(concat(…));
auto s = std::string(concat(…)); Or even std::string s(concat(…)); ? Why bother with the static_cast? -- Olaf