[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] PATCH: Building lmi with gcc 10 and C++20
From: |
Greg Chicares |
Subject: |
Re: [lmi] PATCH: Building lmi with gcc 10 and C++20 |
Date: |
Thu, 14 May 2020 21:39:27 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 |
On 2020-05-10 22:12, Vadim Zeitlin wrote:
[...]
> - pdf_command_wx.cpp:2458:53: error: implicit capture of ‘this’ via ‘[=]’ is
> deprecated in C++20 [-Werror=deprecated]
> 2458 | auto const output_two_column_super_header = [=,&table_gen]
> | ^
> pdf_command_wx.cpp:2458:53: note: add explicit ‘this’ or ‘*this’ capture
>
> Here I've followed the compiler advice by capturing "this" (we don't want
> to make a copy of this object by capturing "*this") and also getting rid
> of the implicit capture mode and capturing everything we need explicitly.
Capturing everything we need explicitly does have a certain charm,
albeit with a countervailing increase in verbosity:
- auto const output_two_column_super_header = [=,&table_gen]
+ auto const output_two_column_super_header =
[this,pos_y,output_mode,z,&table_gen]
so, when I began reading
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0806r2.html
I wondered why you didn't choose the elegant "[=, this]" alternative
(and why I hadn't encountered that syntax before). Then I read the last
sentence of the paper:
| The replacement [=, this] for the deprecated [=] is ill-formed in C++17
| and only available in C++20 as of P0409R2.
and was enlightened. It's probably not worth writing a preprocessor
conditional here.
Aside from that, I had no comments or questions concerning this
patchset. Thanks for doing all this work.