friend declarations are not injected in the enclosing scope by conforming compilers such as g++ 4, so fix compilation by always providing real declarations for operator+(wxString,anything)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2005-12-14 01:55:48 +00:00
parent d1e1aa64cc
commit 1fc8cfbd81

View File

@ -934,16 +934,19 @@ public:
{ *this = str + *this; return *this; }
// non-destructive concatenation
//
friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2);
//
// two strings
friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string1,
const wxString& string2);
// string with a single char
friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch);
//
// char with a string
friend wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string);
//
friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wxChar *psz);
//
friend wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string);
// string with C string
friend wxString WXDLLIMPEXP_BASE operator+(const wxString& string,
const wxChar *psz);
// C string with string
friend wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz,
const wxString& string);
// stream-like functions
// insert an int into string
@ -1292,16 +1295,16 @@ public:
{ return (wxString&)wxStringBase::operator+=(ch); }
};
// IBM xlC compiler needs these operators to be declared in global scope,
// although this shouldn't be a problem for the other compilers we prefer to
// only do it for it in stable 2.6 branch
#ifdef __IBMCPP__
// notice that even though for many compilers the friend declarations above are
// enough, from the point of view of C++ standard we must have the declarations
// here as friend ones are not injected in the enclosing namespace and without
// them the code fails to compile with conforming compilers such as xlC or g++4
wxString WXDLLIMPEXP_BASE operator+(const wxString& string1, const wxString& string2);
wxString WXDLLIMPEXP_BASE operator+(const wxString& string, wxChar ch);
wxString WXDLLIMPEXP_BASE operator+(wxChar ch, const wxString& string);
wxString WXDLLIMPEXP_BASE operator+(const wxString& string, const wxChar *psz);
wxString WXDLLIMPEXP_BASE operator+(const wxChar *psz, const wxString& string);
#endif // __IBMCPP__
// define wxArrayString, for compatibility
#if WXWIN_COMPATIBILITY_2_4 && !wxUSE_STL