C++ Logo


Advanced search

Re: [std-proposals] Fwd: set_new_handler extension

From: Phil Bouchard <boost_at_[hidden]>
Date: Wed, 31 May 2023 22:44:10 -0400
On 5/31/23 20:08, Thiago Macieira wrote:
> On Wednesday, 31 May 2023 16:58:09 PDT Phil Bouchard wrote:
>> - The container::empty() could return a temporary object that can be
>> converted to a boolean but also locks the internal recursive mutex;
> In other words, we need a std::lock_guard or equivalent. How is this different
> from a regular mutex? This is a very simple example and yet we've already got
> ourselves a mutex and needing to think about which operations need to be
> protected so the state doesn't change from under us.

This example shows what I had in mind:

Unfortunately after testing, if the variables are temporary in the "if"
expression, they won't live for the entire scope of the conditional

So again either the rules of C++ needs to be extended to make temporary
variables live longer (it would just consume more space on the memory
stack) or I add it myself to my own personal stack of solutions.


Logo <https://www.fornux.com/>  
*Phil Bouchard*  facebook icon
Founder & CEO
T: (819) 328-4743
E: phil_at_[hidden]| www.fornux.com <http://www.fornux.com>
8 rue de la Baie| Gatineau (Qc), J8T 3H3 Canada
Banner <https://goglobalawards.org/> Le message ci-dessus, ainsi que les
documents l'accompagnant, sont destinés uniquement aux personnes
identifiées et peuvent contenir des informations privilégiées,
confidentielles ou ne pouvant être divulguées. Si vous avez reçu ce
message par erreur, veuillez le détruire.
This communication (and/or the attachments) is intended for named
recipients only and may contain privileged or confidential information
which is not to be disclosed. If you received this communication by
mistake please destroy all copies.

Received on 2023-06-01 02:44:13