lmi
[Top][All Lists]
Advanced

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

Re: [lmi] [lmi-commits] master 9cbda7d 2/4: Simplify


From: Vadim Zeitlin
Subject: Re: [lmi] [lmi-commits] master 9cbda7d 2/4: Simplify
Date: Fri, 5 Oct 2018 18:49:34 +0200

On Fri,  5 Oct 2018 08:58:03 -0400 (EDT) Greg Chicares <address@hidden> wrote:

GC> branch: master
GC> commit 9cbda7d244a0e920f5cac401b06bfd8ce33d9928
GC> Author: Gregory W. Chicares <address@hidden>
GC> Commit: Gregory W. Chicares <address@hidden>
GC> 
GC>     Simplify
GC>     
GC>     See the immediately preceding commit.
GC> ---
GC>  ledger_evaluator.cpp        | 9 +++------
GC>  ledger_evaluator.hpp        | 4 +---
GC>  ledger_pdf_generator_wx.cpp | 2 +-
GC>  3 files changed, 5 insertions(+), 10 deletions(-)
GC> 
GC> diff --git a/ledger_evaluator.cpp b/ledger_evaluator.cpp
GC> index 78b5cd8..f2598d0 100644
GC> --- a/ledger_evaluator.cpp
GC> +++ b/ledger_evaluator.cpp
GC> @@ -1000,14 +1000,10 @@ std::string ledger_evaluator::operator()
GC>  
GC>  void ledger_evaluator::write_tsv
GC>      (fs::path const& // pdf_out_file
GC> -    ,Ledger   const& ledger
GC>      ) const
GC>  {
GC> -    int const length = 
value_cast<int>(operator()("GreatestLapseDuration"));
GC> -    LMI_ASSERT(ledger.is_composite() == ("1" == operator()("Composite")));
GC> -    LMI_ASSERT(ledger.greatest_lapse_dur() == length);
GC>      if
GC> -        (  !ledger.is_composite()
GC> +        (  !("1" == operator()("Composite"))

 This is unrelated to the real purpose of this commit (which is to get rid
of the dependency on "ledger" here, IIUC), but I just wonder if we have to
write operator() call explicitly in lmi code or whether we could use a more
readable, IMO, even if not great "(*this)("Composite")" expression instead?

 Independently of the answer to this question, it could make sense to add a
named function, e.g. value(), in addition to operator() to ledger_evaluator
as writing value("Composite") would be undoubtedly more readable than
either of the alternatives above.

 Regards,
VZ


reply via email to

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