From 868cb07578f432f99ecd2700c9564dbd02824bf4 Mon Sep 17 00:00:00 2001 From: Nikita Kniazev Date: Sun, 1 Dec 2019 17:26:58 +0300 Subject: [PATCH] Try to include std::swap from the most lightweight header Based on Boost.Move idea --- include/boost/core/swap.hpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/include/boost/core/swap.hpp b/include/boost/core/swap.hpp index eff6b97..9820d4a 100644 --- a/include/boost/core/swap.hpp +++ b/include/boost/core/swap.hpp @@ -23,10 +23,25 @@ #include #include -#include //for std::swap (C++11) -#include //for std::swap (C++98) #include //for std::size_t +// try to include std::swap from the most lightweight header +#if defined(BOOST_DINKUMWARE_STDLIB) +# include +#elif defined(_LIBCPP_VERSION) // since the first commit +# include +#elif defined(__GLIBCXX__) && __GLIBCXX__ > 20080621 // GCC 4.4 +# include +#elif defined(__GLIBCXX__) && __GLIBCXX__ > 20071010 // GCC 4.3 +# include +#elif defined(__GLIBCXX__) || defined(__GLIBCPP__) // && __GLIBCPP__ > 20001005 // GCC 2.97 +# include +#elif __cplusplus >= 201103L +# include +#else // C++98/03 fallback +# include +#endif + namespace boost_swap_impl { // we can't use type_traits here