[Top][All Lists]

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

Re: [lmi] clang 10/C++20 build fixes

From: Greg Chicares
Subject: Re: [lmi] clang 10/C++20 build fixes
Date: Sat, 4 Apr 2020 15:08:53 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0

On 2020-04-04 00:09, Vadim Zeitlin wrote:
> On Fri, 3 Apr 2020 22:53:50 +0000 Greg Chicares <address@hidden> wrote:
> GC>   grep '[io]stream' rate_table.hpp
> GC>       database(std::istream& index_is, std::shared_ptr<std::istream> 
> data_is);
> GC>       void save(std::ostream& index_os, std::ostream& data_os);
> GC>   inline std::ostream& operator<<(std::ostream& os, table::Number const& 
> number)
> GC> 
> GC> AFAICT, both std::istream and std::ostream are mentioned either
> GC>  - by reference, or
> GC>  - in the template parameter of std::shared_ptr
> GC> so I thought the ideal fix would be to add
> GC>   #include <iosfwd>
> GC> to the header,
>  No, this is insufficient, std::ostream is actually used in the inline
> implementation of operator<<() overload for table::Number.

Oh. I rewrote it to make my first impression correct, by moving
the implementation out of line. I trust clang will accept that.

> GC> Even after pulling this PR, this command:
> GC>   grep 'std::bind[12]' *.?pp
> GC> finds more occurrences. Do you want to lambda-ize those, too?
>  I see only 3 other occurrences and 2 of them are inside commented out code
> in interest_rates.cpp which I did notice, but decided not to modify because
> I don't think this would be especially useful (just removing the commented
> out code entirely would arguably be more so), but please let me know if you
> feel differently about this.

I do, so I changed it...

>  The remaining case, in expression_template_0_test.cpp, went unnoticed
> because I didn't compile this test with clang, but I should indeed fix it
> -- and I'll do it once I have some sleep and can be sure I don't do
> anything stupid. Thanks for noticing it!

...and that, too. It's amazing how difficult it is to use this approach
to write the equivalent of APL's
which is why, if I want to know what this code does, I read the comment:
  // ET !! Mly7702ig = -1.0 + 1.0 / DBDiscountRate;
and see that it's just 'A←¯1+÷B': "negative one plus reciprocal".

reply via email to

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