Add move operations to wxString
This commit is contained in:
parent
5b951caa79
commit
d00a072dc5
1 changed files with 20 additions and 0 deletions
|
|
@ -1090,6 +1090,14 @@ public:
|
|||
// copy ctor
|
||||
wxString(const wxString& stringSrc) : m_impl(stringSrc.m_impl) { }
|
||||
|
||||
// move ctor
|
||||
wxString(wxString&& stringSrc) noexcept : m_impl(std::move(stringSrc.m_impl))
|
||||
{
|
||||
#if wxUSE_STRING_POS_CACHE
|
||||
stringSrc.InvalidateCache();
|
||||
#endif // wxUSE_STRING_POS_CACHE
|
||||
}
|
||||
|
||||
// string containing nRepeat copies of ch
|
||||
wxString(wxUniChar ch, size_t nRepeat = 1 )
|
||||
{ assign(nRepeat, ch); }
|
||||
|
|
@ -1718,6 +1726,18 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
// move from another wxString
|
||||
wxString& operator=(wxString&& stringSrc) noexcept
|
||||
{
|
||||
m_impl = std::move(stringSrc.m_impl);
|
||||
#if wxUSE_STRING_POS_CACHE
|
||||
InvalidateCache();
|
||||
stringSrc.InvalidateCache();
|
||||
#endif // wxUSE_STRING_POS_CACHE
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
wxString& operator=(const wxCStrData& cstr)
|
||||
{ return *this = cstr.AsString(); }
|
||||
// from a character
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue