lmi
[Top][All Lists]
Advanced

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

Re: [lmi] [lmi-commits] master 6335e9a 1/4: Render comprehensible


From: Vadim Zeitlin
Subject: Re: [lmi] [lmi-commits] master 6335e9a 1/4: Render comprehensible
Date: Thu, 26 Jan 2017 17:55:49 +0100

On Thu, 26 Jan 2017 10:52:47 +0000 Greg Chicares <address@hidden> wrote:

GC> On 2017-01-26 02:43, Greg Chicares wrote:
GC> > On 2017-01-26 01:27, Vadim Zeitlin wrote:
GC> >> 
GC> >>  I'm not sure if you find C++11 vararg templates comprehensible...
GC> [...]
GC> >> ... but the functions check1() and check2() could clearly be combined 
into
GC> >> a single function using them, which would, IMHO, be nicer because these 
not
GC> >> completely trivial functions seem to be identical otherwise.
GC> >> 
GC> >>  I'm not sure if check0() could be easily folded into the same vararg
GC> >> template however, at least with C++11 (with C++17 and its fold 
expressions
GC> >> it would be trivial).
GC> > 
GC> > Then I think this could wait for C++17.
GC> 
GC> No, it turns out to be possible in the 1998 dialect. All we need is
GC>   template<typename T>
GC>   void foo
GC>     (T t
GC>     ,int required_arg_0
GC>     ,char required_arg_1
GC>     ,int optional_arg_0 = 42
GC>     ,...other optional args
GC>     )
GC> because there's only one template parameter.

 Ah, of course, if you can change the existing code and the order of
arguments in it, it makes things simpler. I, as usual, wasn't looking for
the simple and direct alternative :-/

GC> I'm working on this now and will push something soon for your review.

 If this something was 60341554d995fc700e599b59a00ddee6c2882361, then I can
only say that I'm perfectly happy with it, there is no duplication any more
and I prefer seeing check() to check0().

 Two very minor comments concern default arguments:

1. There is no need for them at all in analyze_errors(), as it's always
   called with the full set, so why specify them there?

2. Why use "std::vector<std::string>(0)" instead of, IMO more clear,
   "std::vector<std::string>()"?

 Sorry for nitpicking,
VZ


reply via email to

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