--- Log opened Mon May 30 00:00:38 2022 03:44 < darosior> sipa: (context: https://github.com/bitcoin/bitcoin/pull/24860#discussion_r883686621) if you don't mind giving a C++ lesson, could you further explain to me why we cannot use a lambda? You mention that they are non-assignable, ok, and that the set operations require moving the comparator around. But how comes that moving the comparator around 03:44 < darosior> require it to be assignable? 03:44 < darosior> I had actually tried using a lambda previously but admittedly didn't entirely understand why it failed. 05:01 <@sipa> the set holds an internal variable of type Comparator 05:02 <@sipa> and when std::swap is invoked on the std::set, that involves an assignment to that internal conparator 05:02 <@sipa> but if it is of type lambda, it has no operator= 05:17 <@sipa> (but the swap is not the only problem; i think the set merge or something else also requires a comparator assignment) 05:21 <@sipa> it'd be nice if somehow the ctx variable could be treated as sort of a global from the perspective of the comparator class (as its lifetime is longer than the class definition) so it wouldn't require a copy of the ctx pointer in every set, but there doesn't seem to be a way in c++ to do that 05:36 < darosior> Thanks --- Log closed Tue May 31 00:00:38 2022