Topic: Defect Report: assignment operator can have only one parameter?
Author: Jim Hyslop <jim.hyslop@leitch.com>
Date: 2000/04/03 Raw View
[over.ass] (13.5.3) states "An assignment operator shall be implemented
by a non-static member function with exactly one parameter."
Is the intent of clause 13.5.3 to apply to all assignment operators (=,
+=, *=, etc), or to only the simple assignment operator (operator=)?
The wording and examples in 13.5.3 imply the latter, but a strict
interpretation would apply it to the former, which would disqualify
functions such as:
class T
{
//...
friend float operator +=(float &f, T&);
};
I would suggest that 13.5.3 be re-worded as follows:
"1. A simple assignment operator ..."
"2. Any simple assignment operator ..."
Similarly in [class.copy] (12.8) the Note in paragraph 9 should be
amended to read:
"Note: an overloaded simple assignment operator must be declared to have
only one parameter; see 13.5.3."
--
Jim
I ignore all email from recruitment agencies. Except that
I reserve the right to send rude, nasty replies to recruiters.
Please do not send me email with questions - post
here.
Sent via Deja.com http://www.deja.com/
Before you buy.
[ 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 ]