Topic: identity conversion - ctor required?


Author: Dave <dave@inkdrop.net>
Date: Mon, 16 Jul 2001 17:04:52 GMT
Raw View
Someone asked this question a while ago, but I didn't
see a clear answer.

Given:

     class X a, b;
     a = (X)b;

There are two ways the compiler can handle the assignment:

     temp.X::X(b); a.X::operator=(temp); temp.X::~X();
or
     a.X::operator=(b)

Does an "identity conversion" with the functional cast notation
require that a temporary be created and the class's constructor
be called? Or is it optional? Or is it prohibited? Section 5.2.3
seems to require the temporary. Is there a section that permits
the optimization despite Section 5.2.3? Section and paragraph,
please.

Thanks,

     -- Dave

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.research.att.com/~austern/csc/faq.html                ]