Copy Constructor DIP

meppl mephisto at nordhoff-online.de
Fri Jul 13 07:43:16 UTC 2018


On Thursday, 12 July 2018 at 20:29:43 UTC, Manu wrote:
> On Wed, 11 Jul 2018 at 23:55, RazvanN via Digitalmars-d 
> <digitalmars-d at puremagic.com> wrote:
>>
>> > What's wrong with:
>> > struct S {
>> >   this(ref S copyFrom);
>> > }
>> >
>> > That looks like a perfectly good copy constructor 
>> > declaration ;) I'm just saying, the DIP needs to explain 
>> > this.
>>
>> That is actually a valid constructor, according to today's
>> compiler. There
>> might be code out there that uses this syntax for the 
>> constructor
>> and overnight
>> it will be turned into a copy constructor.
>
> Exactly. Is that a problem?
> It probably IS a copy constructor already, what else could it 
> be? :)
>

it can be something else. For example a lifo list pusher. Even if 
it is considered bad design, someone might have done it



More information about the Digitalmars-d mailing list