170 похожих чатов

Two sad things were found here, one huge and one

annoying:

https://blog.jetbrains.com/clion/2018/06/iso-cpp-committee-rapperswil-2018-trip-report/

Huge. C++20 most likely won't have Modules.

That's disappointing. I hate my compile times (yes, yes, my code is bad, modularization sucks, coupling is tight as hell, etc, etc). But I hate. And I hoped that modules in the standard (=> the same in all three major compilers, I'm building on all of them) would force me to grow and improve structure and design.

Annoying. Implicit capture of this via [=] is now deprecated.

I use lambdas a lot, and I use [=] capture a lot. Many (almost all?) of my closures are guarded by one way or another:

1. They'll automatically unsubscribe themselves when this dies.

or

2. They're guarded by weak pointer to this, so that they're safe to be called even if this is already dead.

Either way, I'm always capturing this by [=], all the time. And converting it to [=, this] will kill half of fun and all of beauty. I've never had a bug (yet?) with incorrect capture of this inside a [=] lambda.

And the motivation (confusion with the newly introduced [*this] capture-by-value) doesn't work for me — I can't imagine (yet?) a single case of [*this] capture in my code :(

1 ответов

4 просмотра

Жалко престона, он копировал this по значению в лямбдах

Похожие вопросы

Обсуждают сегодня

Вопрос по диагностике ошибок (я знаю в чем, в данном конкретном примере, я знаю, как исправить, пример модельный, понятно, что в реальности бывает намного запутаннее). module...
ⰄⰎⰋⰐⰐⰑⰛⰤⰧⰧⰩⰄ ⰊⰑⰁⰓⰡⰛⰦⰕⰫ
10
А дальше что?.. Записать в файл, потом в Код?.. И потом разбирать как-то?..
Хаскель Моисеевич Гопник
14
А чем вам питонисты не угодили?😂
.
79
Есть какой-нибудь для Delphi/FPC T*Compression(Decompression)Stream на базе LZ4/Zstd/любой другой быстрый(и хорошо сжимающий) алгоритм А ещё лучше в pure pascal А ещё лучше од...
notme
51
type TObj = object procedure Init; virtual; end; TObj1 = object(TObj) procedure Init; override; end; procedure TObj1.Init; begin inherited; end; procedur...
Alexander 👋
29
Есть предложения, как подобное можно упростить?
Hemul GM
12
Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
86
@y0zhig @shizzard А можно я опишу цель и может вообще ерланг мне не подходит. На текущий момент как я понимаю у ерланга есть легковесные потоки и задача выполняется в каком т...
Дмитрий Спиридонов
5
У меня вопросик назрел. Почему, создав класс без наследования и реализации деструктора Destroy, деструктор не вызывался при free. Потом указал наследование от tobject и overri...
Сергей Бычков
9
Такой вопросец - есть функция function MySuperDuperConcat(const a: array of AnsiString): AnsiString; Как мне в её теле сделать вот так? Result:=Concat(a); А не грустный вариан...
notme
15
Карта сайта