I don't think we need a new keyword everytime you want to avoid repeating a couple of lines.
Create macros and go nuts :)

I would expect people to at least log the exception in the cleanup code. So that block keyword would be useless.
And all these special rules that you're creating on the fly to make it sort of work...

At this point it just looks like you're trolling this list nonstop.

There are other means to discuss half-baked ideas, like slack, discord and reddit. Please try those other places to bounce quick ideas so this list is less polluted.

Breno G.


Em dom., 25 de fev. de 2024 11:16, Frederick Virchanza Gotham via Std-Proposals <std-proposals@lists.isocpp.org> escreveu:


On Sunday, February 25, 2024, Frederick Virchanza Gotham wrote:

If you absolutely must create a variable of class type that might throw, then use std::optional:

      { _Bulldoze:
          optional<stringstream> ss;
          if ( ss ) *ss << 77;
          if ( ss ) cout << std::move(*ss).str();
      }


I forgot the 'emplace':

     { _Bulldoze:
          optional<stringstream> ss;
          ss.emplace();
          if ( ss ) *ss << 77;
          if ( ss ) cout << std::move(*ss).str();
      }

--
Std-Proposals mailing list
Std-Proposals@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals