C++ Logo

std-proposals

Advanced search

Re: [std-proposals] inline function within class definition can define member objects

From: Phil Bouchard <boost_at_[hidden]>
Date: Sat, 15 Oct 2022 15:53:36 -0400
On 10/15/22 15:50, Frederick Virchanza Gotham via Std-Proposals wrote:
> I propose that the following:
>
> struct Foo {
>
> int Method(int arg)
> {
> int Foo::record;
>
> record = arg;
>
> return arg + 4u;
> }
> };
>
> behaves the same as:
>
> struct Foo {
>
> int record;
>
> int Method(int arg)
> {
> record = arg;
>
> return arg + 4u;
> }
> };
>
> There are times when a method needs a simple variable such as a
> counter or a boolean, and so we then need to add a member variable to
> the class definition. I'm proposing that we can do all of this inside
> the body of the method -- so long as the body of the method is inline
> inside the class definition. I also propose that the variable "record"
> would be inaccessible by other methods.

That's going down the "Python path" of making the code more obscure and
less maintainable IMHO...


-- 
Email Signature
Logo <https://www.fornux.com/>  
*Phil Bouchard*  facebook icon 
<https://www.linkedin.com/in/phil-bouchard-5723a910/>
CTO
T: (819) 328-4743
E: phil_at_[hidden]| www.fornux.com <http://www.fornux.com>
1188 rue Saint-Louis| Gatineau (Qc), J8T 2L8 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 2022-10-15 19:53:38