From 0fd8ec0fa20924d7f9a0846c84a5f8ad2ba2bd89 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 13 Sep 2018 19:20:07 +0200 Subject: [PATCH] Include to get std::swap() declaration in C++11 Include both , to get std::swap() declaration when using C++98, and , 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. --- include/wx/unichar.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/wx/unichar.h b/include/wx/unichar.h index 5d731754b1..01c188907e 100644 --- a/include/wx/unichar.h +++ b/include/wx/unichar.h @@ -14,7 +14,12 @@ #include "wx/chartype.h" #include "wx/stringimpl.h" -#include // 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 // std::swap() for C++98 +#include // std::swap() for C++11 class WXDLLIMPEXP_FWD_BASE wxUniCharRef; class WXDLLIMPEXP_FWD_BASE wxString;