Remove unnecessary copy ctors/copy assignment operators

C++11 deprecates having one without the other.
Eliminates many, many GCC -Wdeprecated-copy warnings.
This commit is contained in:
Paul Cornett
2019-10-14 09:07:21 -07:00
parent 764c01832d
commit a3598ba33f
15 changed files with 0 additions and 106 deletions

View File

@@ -62,7 +62,6 @@ public:
const wxString& second); const wxString& second);
wxArrayString() { } wxArrayString() { }
wxArrayString(const wxArrayString& a) : wxArrayStringBase(a) { }
wxArrayString(size_t sz, const char** a); wxArrayString(size_t sz, const char** a);
wxArrayString(size_t sz, const wchar_t** a); wxArrayString(size_t sz, const wchar_t** a);
wxArrayString(size_t sz, const wxString* a); wxArrayString(size_t sz, const wxString* a);
@@ -105,9 +104,6 @@ class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase
public: public:
wxSortedArrayString() : wxSortedArrayStringBase(wxStringSortAscending) wxSortedArrayString() : wxSortedArrayStringBase(wxStringSortAscending)
{ } { }
wxSortedArrayString(const wxSortedArrayString& array)
: wxSortedArrayStringBase(array)
{ }
wxSortedArrayString(const wxArrayString& src) wxSortedArrayString(const wxArrayString& src)
: wxSortedArrayStringBase(wxStringSortAscending) : wxSortedArrayStringBase(wxStringSortAscending)
{ {

View File

@@ -42,12 +42,6 @@ public:
m_icon(icon) m_icon(icon)
{ } { }
wxDataViewIconText( const wxDataViewIconText &other )
: wxObject(),
m_text(other.m_text),
m_icon(other.m_icon)
{ }
void SetText( const wxString &text ) { m_text = text; } void SetText( const wxString &text ) { m_text = text; }
wxString GetText() const { return m_text; } wxString GetText() const { return m_text; }
void SetIcon( const wxIcon &icon ) { m_icon = icon; } void SetIcon( const wxIcon &icon ) { m_icon = icon; }

View File

@@ -235,13 +235,6 @@ public:
explicit wxBaseSortedArray(SCMPFUNC fn) : m_fnCompare(fn) { } explicit wxBaseSortedArray(SCMPFUNC fn) : m_fnCompare(fn) { }
wxBaseSortedArray& operator=(const wxBaseSortedArray& src)
{
wxBaseArray<T, Sorter>::operator=(src);
m_fnCompare = src.m_fnCompare;
return *this;
}
size_t IndexForInsert(T item) const size_t IndexForInsert(T item) const
{ {
return this->wxBaseArray<T, Sorter>::IndexForInsert(item, m_fnCompare); return this->wxBaseArray<T, Sorter>::IndexForInsert(item, m_fnCompare);
@@ -656,9 +649,6 @@ private:
wxBaseObjectArrayFor##name; \ wxBaseObjectArrayFor##name; \
classdecl name : public wxBaseObjectArrayFor##name \ classdecl name : public wxBaseObjectArrayFor##name \
{ \ { \
public: \
name() : wxBaseObjectArrayFor##name() { } \
name(const name& src) : wxBaseObjectArrayFor##name(src) { } \
} }
#define WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, expmode) \ #define WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name, expmode) \

View File

@@ -635,16 +635,6 @@ public:
void SetCol( int n ) { m_col = n; } void SetCol( int n ) { m_col = n; }
void Set( int row, int col ) { m_row = row; m_col = col; } void Set( int row, int col ) { m_row = row; m_col = col; }
wxGridCellCoords& operator=( const wxGridCellCoords& other )
{
if ( &other != this )
{
m_row=other.m_row;
m_col=other.m_col;
}
return *this;
}
bool operator==( const wxGridCellCoords& other ) const bool operator==( const wxGridCellCoords& other ) const
{ {
return (m_row == other.m_row && m_col == other.m_col); return (m_row == other.m_row && m_col == other.m_col);

View File

@@ -629,7 +629,6 @@ public:
{ m_x *= ((wxDouble)num)/((wxDouble)denum); m_y *= ((wxDouble)num)/((wxDouble)denum); { m_x *= ((wxDouble)num)/((wxDouble)denum); m_y *= ((wxDouble)num)/((wxDouble)denum);
m_width *= ((wxDouble)num)/((wxDouble)denum); m_height *= ((wxDouble)num)/((wxDouble)denum);} m_width *= ((wxDouble)num)/((wxDouble)denum); m_height *= ((wxDouble)num)/((wxDouble)denum);}
wxRect2DDouble& operator = (const wxRect2DDouble& rect);
inline bool operator == (const wxRect2DDouble& rect) const inline bool operator == (const wxRect2DDouble& rect) const
{ return wxIsSameDouble(m_x, rect.m_x) && wxIsSameDouble(m_y, rect.m_y) && HaveEqualSize(rect); } { return wxIsSameDouble(m_x, rect.m_x) && wxIsSameDouble(m_y, rect.m_y) && HaveEqualSize(rect); }
inline bool operator != (const wxRect2DDouble& rect) const inline bool operator != (const wxRect2DDouble& rect) const

View File

@@ -28,15 +28,6 @@ public:
wxDataFormat( const wchar_t *id ) { InitFromString(id); } wxDataFormat( const wchar_t *id ) { InitFromString(id); }
wxDataFormat( const wxCStrData& id ) { InitFromString(id); } wxDataFormat( const wxCStrData& id ) { InitFromString(id); }
wxDataFormat& operator=(const wxDataFormat& format)
{
if (&format != this)
{
m_type = format.m_type;
m_format = format.m_format;
}
return *this;
}
wxDataFormat& operator=(NativeFormat format) wxDataFormat& operator=(NativeFormat format)
{ SetId(format); return *this; } { SetId(format); return *this; }

View File

@@ -450,11 +450,6 @@ CLASSEXP CLASSNAME \
public: \ public: \
CLASSNAME() { } \ CLASSNAME() { } \
const_key_reference operator()( const_pair_reference pair ) const { return pair.first; }\ const_key_reference operator()( const_pair_reference pair ) const { return pair.first; }\
\
/* the dummy assignment operator is needed to suppress compiler */ \
/* warnings from hash table class' operator=(): gcc complains about */ \
/* "statement with no effect" without it */ \
CLASSNAME& operator=(const CLASSNAME&) { return *this; } \
}; };
// grow/shrink predicates // grow/shrink predicates
@@ -471,10 +466,6 @@ inline bool grow_lf70( size_t buckets, size_t items )
// hashing and comparison functors // hashing and comparison functors
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// NB: implementation detail: all of these classes must have dummy assignment
// operators to suppress warnings about "statement with no effect" from gcc
// in the hash table class assignment operator (where they're assigned)
#ifndef wxNEEDS_WX_HASH_MAP #ifndef wxNEEDS_WX_HASH_MAP
// integer types // integer types
@@ -536,8 +527,6 @@ struct WXDLLIMPEXP_BASE wxIntegerHash
wxULongLong_t operator()( wxLongLong_t x ) const { return static_cast<wxULongLong_t>(x); } wxULongLong_t operator()( wxLongLong_t x ) const { return static_cast<wxULongLong_t>(x); }
wxULongLong_t operator()( wxULongLong_t x ) const { return x; } wxULongLong_t operator()( wxULongLong_t x ) const { return x; }
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG #endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
wxIntegerHash& operator=(const wxIntegerHash&) { return *this; }
}; };
#endif // !wxNEEDS_WX_HASH_MAP/wxNEEDS_WX_HASH_MAP #endif // !wxNEEDS_WX_HASH_MAP/wxNEEDS_WX_HASH_MAP
@@ -555,8 +544,6 @@ struct WXDLLIMPEXP_BASE wxIntegerEqual
bool operator()( wxLongLong_t a, wxLongLong_t b ) const { return a == b; } bool operator()( wxLongLong_t a, wxLongLong_t b ) const { return a == b; }
bool operator()( wxULongLong_t a, wxULongLong_t b ) const { return a == b; } bool operator()( wxULongLong_t a, wxULongLong_t b ) const { return a == b; }
#endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG #endif // wxHAS_LONG_LONG_T_DIFFERENT_FROM_LONG
wxIntegerEqual& operator=(const wxIntegerEqual&) { return *this; }
}; };
// pointers // pointers
@@ -569,16 +556,12 @@ struct WXDLLIMPEXP_BASE wxPointerHash
#else #else
size_t operator()( const void* k ) const { return (size_t)k; } size_t operator()( const void* k ) const { return (size_t)k; }
#endif #endif
wxPointerHash& operator=(const wxPointerHash&) { return *this; }
}; };
struct WXDLLIMPEXP_BASE wxPointerEqual struct WXDLLIMPEXP_BASE wxPointerEqual
{ {
wxPointerEqual() { } wxPointerEqual() { }
bool operator()( const void* a, const void* b ) const { return a == b; } bool operator()( const void* a, const void* b ) const { return a == b; }
wxPointerEqual& operator=(const wxPointerEqual&) { return *this; }
}; };
// wxString, char*, wchar_t* // wxString, char*, wchar_t*
@@ -603,8 +586,6 @@ struct WXDLLIMPEXP_BASE wxStringHash
static unsigned long stringHash( const wchar_t* ); static unsigned long stringHash( const wchar_t* );
static unsigned long stringHash( const char* ); static unsigned long stringHash( const char* );
wxStringHash& operator=(const wxStringHash&) { return *this; }
}; };
struct WXDLLIMPEXP_BASE wxStringEqual struct WXDLLIMPEXP_BASE wxStringEqual
@@ -618,8 +599,6 @@ struct WXDLLIMPEXP_BASE wxStringEqual
bool operator()( const char* a, const char* b ) const bool operator()( const char* a, const char* b ) const
{ return strcmp( a, b ) == 0; } { return strcmp( a, b ) == 0; }
#endif // wxUSE_UNICODE #endif // wxUSE_UNICODE
wxStringEqual& operator=(const wxStringEqual&) { return *this; }
}; };
#ifdef wxNEEDS_WX_HASH_MAP #ifdef wxNEEDS_WX_HASH_MAP

View File

@@ -106,11 +106,6 @@ public: \
CLASSNAME() { } \ CLASSNAME() { } \
const_key_reference operator()( const_key_reference key ) const \ const_key_reference operator()( const_key_reference key ) const \
{ return key; } \ { return key; } \
\
/* the dummy assignment operator is needed to suppress compiler */ \
/* warnings from hash table class' operator=(): gcc complains about */ \
/* "statement with no effect" without it */ \
CLASSNAME& operator=(const CLASSNAME&) { return *this; } \
}; };
#define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP )\ #define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP )\

View File

@@ -1312,11 +1312,6 @@ public:
*/ */
wxTextBoxAttr() { Init(); } wxTextBoxAttr() { Init(); }
/**
Copy constructor.
*/
wxTextBoxAttr(const wxTextBoxAttr& attr) { Init(); (*this) = attr; }
/** /**
Initialises this object. Initialises this object.
*/ */

View File

@@ -132,9 +132,6 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextCharacterStyleDefinition: public wxRichText
wxDECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition); wxDECLARE_DYNAMIC_CLASS(wxRichTextCharacterStyleDefinition);
public: public:
/// Copy constructor
wxRichTextCharacterStyleDefinition(const wxRichTextCharacterStyleDefinition& def): wxRichTextStyleDefinition(def) {}
/// Default constructor /// Default constructor
wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString): wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString):
wxRichTextStyleDefinition(name) {} wxRichTextStyleDefinition(name) {}

View File

@@ -71,13 +71,6 @@ private:
class WXDLLIMPEXP_NET wxIPaddress : public wxSockAddress class WXDLLIMPEXP_NET wxIPaddress : public wxSockAddress
{ {
public: public:
wxIPaddress() : wxSockAddress() { }
wxIPaddress(const wxIPaddress& other)
: wxSockAddress(other),
m_origHostname(other.m_origHostname)
{
}
bool operator==(const wxIPaddress& addr) const; bool operator==(const wxIPaddress& addr) const;
bool Hostname(const wxString& name); bool Hostname(const wxString& name);
@@ -120,9 +113,6 @@ private:
class WXDLLIMPEXP_NET wxIPV4address : public wxIPaddress class WXDLLIMPEXP_NET wxIPV4address : public wxIPaddress
{ {
public: public:
wxIPV4address() : wxIPaddress() { }
wxIPV4address(const wxIPV4address& other) : wxIPaddress(other) { }
// implement wxSockAddress pure virtuals: // implement wxSockAddress pure virtuals:
virtual Family Type() wxOVERRIDE { return IPV4; } virtual Family Type() wxOVERRIDE { return IPV4; }
virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV4address(*this); } virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV4address(*this); }
@@ -155,9 +145,6 @@ private:
class WXDLLIMPEXP_NET wxIPV6address : public wxIPaddress class WXDLLIMPEXP_NET wxIPV6address : public wxIPaddress
{ {
public: public:
wxIPV6address() : wxIPaddress() { }
wxIPV6address(const wxIPV6address& other) : wxIPaddress(other) { }
// implement wxSockAddress pure virtuals: // implement wxSockAddress pure virtuals:
virtual Family Type() wxOVERRIDE { return IPV6; } virtual Family Type() wxOVERRIDE { return IPV6; }
virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV6address(*this); } virtual wxSockAddress *Clone() const wxOVERRIDE { return new wxIPV6address(*this); }
@@ -192,9 +179,6 @@ private:
class WXDLLIMPEXP_NET wxUNIXaddress : public wxSockAddress class WXDLLIMPEXP_NET wxUNIXaddress : public wxSockAddress
{ {
public: public:
wxUNIXaddress() : wxSockAddress() { }
wxUNIXaddress(const wxUNIXaddress& other) : wxSockAddress(other) { }
void Filename(const wxString& name); void Filename(const wxString& name);
wxString Filename() const; wxString Filename() const;

View File

@@ -911,8 +911,6 @@ public:
public: public:
iterator() {} iterator() {}
iterator(const iterator& i) : m_cur(i.m_cur) {}
reference operator*() reference operator*()
{ return wxUniCharRef::CreateForString(m_cur); } { return wxUniCharRef::CreateForString(m_cur); }
@@ -946,7 +944,6 @@ public:
public: public:
const_iterator() {} const_iterator() {}
const_iterator(const const_iterator& i) : m_cur(i.m_cur) {}
const_iterator(const iterator& i) : m_cur(i.m_cur) {} const_iterator(const iterator& i) : m_cur(i.m_cur) {}
const_reference operator*() const const_reference operator*() const
@@ -1015,8 +1012,6 @@ public:
reverse_iterator_impl() {} reverse_iterator_impl() {}
reverse_iterator_impl(iterator_type i) : m_cur(i) {} reverse_iterator_impl(iterator_type i) : m_cur(i) {}
reverse_iterator_impl(const reverse_iterator_impl& ri)
: m_cur(ri.m_cur) {}
iterator_type base() const { return m_cur; } iterator_type base() const { return m_cur; }

View File

@@ -144,7 +144,6 @@ public:
bool operator&&(bool v) const { return (bool)*this && v; } bool operator&&(bool v) const { return (bool)*this && v; }
// Assignment operators: // Assignment operators:
wxUniChar& operator=(const wxUniChar& c) { if (&c != this) m_value = c.m_value; return *this; }
wxUniChar& operator=(const wxUniCharRef& c); wxUniChar& operator=(const wxUniCharRef& c);
wxUniChar& operator=(char c) { m_value = From8bit(c); return *this; } wxUniChar& operator=(char c) { m_value = From8bit(c); return *this; }
wxUniChar& operator=(unsigned char c) { m_value = From8bit((char)c); return *this; } wxUniChar& operator=(unsigned char c) { m_value = From8bit((char)c); return *this; }

View File

@@ -194,7 +194,6 @@ public:
reverse_iterator() : m_ptr(NULL) { } reverse_iterator() : m_ptr(NULL) { }
explicit reverse_iterator(iterator it) : m_ptr(it) { } explicit reverse_iterator(iterator it) : m_ptr(it) { }
reverse_iterator(const reverse_iterator& it) : m_ptr(it.m_ptr) { }
reference operator*() const { return *m_ptr; } reference operator*() const { return *m_ptr; }
pointer operator->() const { return m_ptr; } pointer operator->() const { return m_ptr; }

View File

@@ -138,15 +138,6 @@ void wxRect2DDouble::ConstrainTo( const wxRect2DDouble &rect )
SetTop( rect.GetTop() ); SetTop( rect.GetTop() );
} }
wxRect2DDouble& wxRect2DDouble::operator=( const wxRect2DDouble &r )
{
m_x = r.m_x;
m_y = r.m_y;
m_width = r.m_width;
m_height = r.m_height;
return *this;
}
// integer version // integer version
// for the following calculations always remember // for the following calculations always remember