🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c++
Article #1620

Re: Why not A::A(something) : A(other) {} ?

#1620
From: David Vandevoorde
Date: Fri, 04 Aug 1995 23:03
33 lines
1332 bytes
In article <3vtd09$83f@usenet.rpi.edu>, Lance Page <page@cat.rpi.edu> wrote:
>
>I propose that a constructor for a class A be allowed to invoke another
>constructor of A in place of its base class & member initializers.
>e.g.:
>
>class A {
>  A(other);
>  A(something) : A(other) {}                        
>  ...
>};
>
[...]
>Anyway... "why not?".
>
>-Lance Page

Except for the initializer-list, I don't see how factoring out the
common construction adds significant overhead:

	struct A {
	    A("other"): "init_list" { ... construct(common); ... }
            A("something"): "init_list" { ... construct("common"); ... }
            // ...
        private:
            void construct("common") ...
            // ...
        };

The initializer list must be repeated, but I think that is rarely
a problem, is it?

	Daveed
Technical Details
Message-ID: <3vu8ve$e6h@usenet.rpi.edu>
Path: arc1-ca.pugleaf.net!kbad.eglin.af.mil!rpi!vandevod
References: <3vtd09$83f@usenet.rpi.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!kbad.eglin.af.mil!rpi!vandevod
From: vandevod@ro.cs.rpi.edu (David Vandevoorde)
Newsgroups: comp.std.c++
Subject: Re: Why not A::A(something) : A(other) {} ?
Date: 4 Aug 1995 23:03:10 GMT
Organization: Computer Science Department at Rensselaer, Troy, NY
Message-ID: <3vu8ve$e6h@usenet.rpi.edu>
References: <3vtd09$83f@usenet.rpi.edu>
NNTP-Posting-Host: ro.cs.rpi.edu
Summary: How significant a benefit is it really?
Keywords: private member construction