🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c++
Article #153

Re: A bit of a pointless puzzle: avoiding copy constructor

#153
From: Ross Finlayson
Date: Sun, 11 Oct 2026 00:38
26 lines
1980 bytes
On 10/10/2026 10:27 AM, Andrey Tarasevich wrote:
> One can easily produce a definition for class `C`, under which the
> following copy-initialization
>
>    C a, b = a;
>
> will use some "other" constructor instead of the copy constructor.
>
> But what about direct-initialization
>
>    C a, b(a);
>
> ? Is there any way to somehow drive this form of initialization away
> from the copy-constructor and make it use some other constructor?
>
> The
>
>    const C a;
>    C b(a);
>
> case is easy, but what about plain `a`?
>

(No.)

Technical Details
Message-ID: <TBycnREEwcw5R1f3nZ2dnZfqn_adnZ2d@giganews.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.nrbbs.org!border-3.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
References: <11adsj0$1ub96$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.nrbbs.org!border-3.nntp.ord.giganews.com!nntp.giganews.com!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sun, 11 Oct 2026 00:39:00 +0000
Subject: Re: A bit of a pointless puzzle: avoiding copy constructor
Newsgroups: comp.lang.c++
References: <11adsj0$1ub96$1@dont-email.me>
From: Ross Finlayson <ross.a.finlayson@gmail.com>
Date: Sat, 10 Oct 2026 17:38:53 -0700
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
 Thunderbird/38.6.0
MIME-Version: 1.0
In-Reply-To: <11adsj0$1ub96$1@dont-email.me>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Message-ID: <TBycnREEwcw5R1f3nZ2dnZfqn_adnZ2d@giganews.com>
Lines: 26
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-AcEeDB6XCvYPcbi2D4xV64K+9+CSj3uyf/GJC5eFrh6pjIFCcegvwxMLe0ATmdXYH4o0PD/wpT8toP1!T1xFKAS41em1vwpcpIGNoSfpfHA7SyuwHNPQjMPBUOtA7kh+SfoN+4iq2IRVM5YUQ9/3tjKIFVY=
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40