Include <utility> to get std::swap() declaration in C++11

Include both <algorithm>, to get std::swap() declaration when using
C++98, and <utility>, to do the same thing when using C++11.

This is not pretty but simpler than using preprocessor tests (which
would need to take MSVS into account in a special way) and virtually
guaranteed not to break anything.

Closes #18220.
This commit is contained in:
Vadim Zeitlin 2018-09-13 19:20:07 +02:00
parent 6401c2e956
commit 0fd8ec0fa2

View File

@ -14,7 +14,12 @@
#include "wx/chartype.h"
#include "wx/stringimpl.h"
#include <algorithm> // only for std::swap specialization below
// We need to get std::swap() declaration in order to specialize it below and
// it is declared in different headers for C++98 and C++11. Instead of testing
// which one is being used, just include both of them as it's simpler and less
// error-prone.
#include <algorithm> // std::swap() for C++98
#include <utility> // std::swap() for C++11
class WXDLLIMPEXP_FWD_BASE wxUniCharRef;
class WXDLLIMPEXP_FWD_BASE wxString;