Topic: Default assignment operator: when is it unavailable?
Author: sbnaran@localhost.localdomain (Siemel Naran)
Date: 1999/08/02 Raw View
On 02 Aug 99 05:22:36 GMT, djsolum@ix.netcom.com <djsolum@ix.netcom.com> wrote:
>Does the C++ standard say anywhere that the default assignment operator is
>not available in any class that contains one or more (non-static) data
>members of const or reference type?
It probably says it somewhere. As a reference is like a const pointer
*const, a struct/class containing reference members can't be assigned
to. That is, the reference and other const members are set in the
initialization list of the constructor, and they can't change.
(Except with the placement new hack.)
--
----------------------------------
Siemel B. Naran (sbnaran@uiuc.edu)
----------------------------------
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "1 2" <djsolum@ix.netcom.com>
Date: 1999/08/02 Raw View
Forgive me if this has been asked before - I didn't see it addressed
anywhere in this newsgroup or the standard:
Does the C++ standard say anywhere that the default assignment operator is
not available in any class that contains one or more (non-static) data
members of const or reference type?
This is how my compiler works, but it is not documented that way in any of
my references.
Thank you.
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]
Author: "Darin Adler" <darin@bentspoon.com>
Date: 1999/08/02 Raw View
djsolum@ix.netcom.com wrote:
> Does the C++ standard say anywhere that the default assignment operator is
> not available in any class that contains one or more (non-static) data
> members of const or reference type?
Yes, in paragraph 12.8/12.
-- Darin
---
[ 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://reality.sgi.com/austern_mti/std-c++/faq.html ]