🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Q: is A a = 100; equivalent to A a (100); ?

#2244
From: Matt Austern
Date: Wed, 18 Oct 1995 18:27
24 lines
1815 bytes
In article <4638jp$ef4@fsgm01.fnal.gov> b91926@fsgm01.fnal.gov (David Sachs) writes:

> X x(a) uses higher priority conversion by overloading rules
> 
> X x=a uses X(a.operator X&)

Sort of.  If a is of class A, if the copy constructor X::X(const X&)
exists, and if the converting constructor X::X(const A&) exists and
isn't qualified as explicit, then "X x(a)" simply invokes the
converting constructor while "X x=a" invokes the converting
constructor and then the copy constructor.

Section 12.6 of the working paper explains this in detail.  The rest
of chapter 12 is somewhat relevant too.
-- 
  Matt Austern                             He showed his lower teeth.  "We 
  matt@physics.berkeley.edu                all have flaws," he said, "and 
  http://dogbert.lbl.gov/~matt             mine is being wicked."

---
[ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy
  is summarized in http://dogbert.lbl.gov/~matt/std-c++/policy.html. ]
Technical Details
Message-ID: <MATT.95Oct18111956@godzilla.EECS.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
References: <JLM.95Oct12202250@ludo.two-oo-one.fr> <u9burle2pv.fsf@yorick.cygnus.com> <45skdo$cm4@engnews2.Eng.Sun.COM> <45sl3a$coc@engnews2.Eng.Sun.COM> <9510161109.AA08959@slsvgqt.lts.sel.alcatel.de> <damian.813960961@molly.cs.monash.edu.au> <4638jp$ef4@fsgm01.fnal.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!128.32.155.1!matt
From: matt@godzilla.EECS.Berkeley.EDU (Matt Austern)
Newsgroups: comp.std.c++
Subject: Re: Q: is A a = 100; equivalent to A a (100); ?
Date: 18 Oct 1995 18:27:39 GMT
Organization: University of California at Berkeley (computational neuroscience)
Approved: matt@physics2.Berkeley.EDU (Matt Austern)
Message-ID: <MATT.95Oct18111956@godzilla.EECS.Berkeley.EDU>
References: <JLM.95Oct12202250@ludo.two-oo-one.fr>
 <u9burle2pv.fsf@yorick.cygnus.com> <45skdo$cm4@engnews2.Eng.Sun.COM>
 <45sl3a$coc@engnews2.Eng.Sun.COM>
 <9510161109.AA08959@slsvgqt.lts.sel.alcatel.de>
 <damian.813960961@molly.cs.monash.edu.au> <4638jp$ef4@fsgm01.fnal.gov>
Reply-To: matt@physics.berkeley.edu
NNTP-Posting-Host: physics2.berkeley.edu