lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] [PATCH] C++ m11n: range-based for loops


From: Greg Chicares
Subject: Re: [lmi] [PATCH] C++ m11n: range-based for loops
Date: Tue, 17 Jan 2017 01:59:59 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.6.0

On 2017-01-16 17:20, Vadim Zeitlin wrote:
> On Mon, 16 Jan 2017 15:43:07 +0000 Greg Chicares <address@hidden> wrote:
> 
> GC> +wx_test_paste_census.cpp
> GC> We should certainly dispense with the iterator typedef. But compare
> GC> your patch to what I committed: do you still want to introduce an
> GC> extra variable?
> 
>  I think the code using "first" is more clear

Okay, you wrote it, and you're maintaining it, so I've changed it
accordingly.

>  BTW, I find it useful to have some kind of "once only" helper class, e.g.
[...]
> and then use it like this:
> 
>       do_once_only skip_comma;
>       for(auto const& s : remaining)
>           {
>           if(!skip_comma)
>               message << ",";
>           message << " '" << s << "'";
>           }

As for me, I'd implement this function thus:

    std::ostringstream oss;
    oss
        << "Checking columns: "
        << insert_commas_between_elements(quote_elements(remaining))
        << " not found."
        ;

avoiding the 'first' and 'only_one' special cases. But of course TIMTOWTDI.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]