Return reference to this in operator=()

This is the recommendede signature of assignment operators and was found by
cppcheck.
This commit is contained in:
Georg Baum 2015-09-13 19:43:44 +02:00
parent d4a79d81d2
commit c09663d2cb
2 changed files with 4 additions and 3 deletions

View File

@ -50,12 +50,13 @@ InsetGraphicsParams::InsetGraphicsParams(InsetGraphicsParams const & igp)
}
void InsetGraphicsParams::operator=(InsetGraphicsParams const & params)
InsetGraphicsParams & InsetGraphicsParams::operator=(InsetGraphicsParams const & params)
{
// Are we assigning the object into itself?
if (this == &params)
return;
return *this;
copy(params);
return *this;
}

View File

@ -68,7 +68,7 @@ public:
///
InsetGraphicsParams(InsetGraphicsParams const &);
///
void operator=(InsetGraphicsParams const &);
InsetGraphicsParams & operator=(InsetGraphicsParams const &);
/// Save the parameters in the LyX format stream.
/// Buffer is needed to figure out if a figure is embedded.
void Write(std::ostream & os, Buffer const & buf) const;