From dc96dcab3f4c414e87384daed329ff726d669ab0 Mon Sep 17 00:00:00 2001 From: Mikhail Novosyolov Date: Wed, 1 Apr 2020 08:01:56 +0300 Subject: [PATCH 1/2] Minimal compatibility with C++17 C++17 removed std::bind*nd and LLVM libc++ removed them without a way to force backwards compatibility. Based on patch from Daniel Arndt https://github.com/dealii/dealii/pull/6126/commits/01fba74717d2b8c896317f1a6ad1894fb03d67a0 Note: std:auto_ptr currently can be reenabled in libc++: https://libcxx.llvm.org/docs/UsingLibcxx.html#c-17-specific-configuration-macros Signed-off-by: Mikhail Novosyolov --- boost/container/string.hpp | 22 +++++++++++++++++++ .../distributed/detail/mpi_process_group.ipp | 4 ++++ boost/random/uniform_on_sphere.hpp | 2 +- .../core/non_terminal/impl/grammar.ipp | 2 +- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/boost/container/string.hpp b/boost/container/string.hpp index 33f5f661..22d59e4d 100644 --- a/boost/container/string.hpp +++ b/boost/container/string.hpp @@ -528,7 +528,11 @@ class basic_string bool operator()(const typename Tr::char_type& x) const { return std::find_if(m_first, m_last, + #if __cplusplus < 201703L std::bind1st(Eq_traits(), x)) == m_last; + #else + [](const argument_type &ch) {return Eq_traits(x, ch)}) == m_last; + #endif } }; #endif //#ifndef BOOST_CONTAINER_DOXYGEN_INVOKED @@ -2109,7 +2113,11 @@ class basic_string pointer finish = addr + sz; const const_iterator result = std::find_if(addr + pos, finish, + #if __cplusplus < 201703L std::bind2nd(Eq_traits(), c)); + #else + [](const argument_type &ch) {return Eq_traits(ch, c)}); + #endif return result != finish ? result - begin() : npos; } } @@ -2169,7 +2177,11 @@ class basic_string const const_iterator last = begin() + container_detail::min_value(len - 1, pos) + 1; const_reverse_iterator rresult = std::find_if(const_reverse_iterator(last), rend(), + #if __cplusplus < 201703L std::bind2nd(Eq_traits(), c)); + #else + [](const argument_type &ch) {return Eq_traits(ch, c)}); + #endif return rresult != rend() ? (rresult.base() - 1) - begin() : npos; } } @@ -2312,8 +2324,13 @@ class basic_string const pointer addr = this->priv_addr(); const pointer finish = addr + this->priv_size(); const const_iterator result + #if __cplusplus < 201703L = std::find_if(addr + pos, finish, std::not1(std::bind2nd(Eq_traits(), c))); + #else + = std::find_if_not(addr + pos, finish, + [](const argument_type &ch) {return Eq_traits(ch, c)}); + #endif return result != finish ? result - begin() : npos; } } @@ -2368,8 +2385,13 @@ class basic_string else { const const_iterator last = begin() + container_detail::min_value(len - 1, pos) + 1; const const_reverse_iterator rresult = + #if __cplusplus < 201703L std::find_if(const_reverse_iterator(last), rend(), std::not1(std::bind2nd(Eq_traits(), c))); + #else + std::find_if_not(const_reverse_iterator(last), rend(), + [](const argument_type &ch) {return Eq_traits(ch, c)}); + #endif return rresult != rend() ? (rresult.base() - 1) - begin() : npos; } } diff --git a/boost/graph/distributed/detail/mpi_process_group.ipp b/boost/graph/distributed/detail/mpi_process_group.ipp index a4d35462..02058b00 100644 --- a/boost/graph/distributed/detail/mpi_process_group.ipp +++ b/boost/graph/distributed/detail/mpi_process_group.ipp @@ -841,7 +841,11 @@ all_gather(const mpi_process_group& pg, InputIterator first, // Adjust sizes based on the number of bytes std::transform(sizes.begin(), sizes.end(), sizes.begin(), + #if __cplusplus < 201703L std::bind2nd(std::multiplies(), sizeof(T))); + #else + [](const int& size){return std::multiplies(size, sizeof(T))}); + #endif // Compute displacements std::vector displacements; diff --git a/boost/random/uniform_on_sphere.hpp b/boost/random/uniform_on_sphere.hpp index 72c25ef7..d5037352 100644 --- a/boost/random/uniform_on_sphere.hpp +++ b/boost/random/uniform_on_sphere.hpp @@ -19,7 +19,7 @@ #include #include // std::transform -#include // std::bind2nd, std::divides +#include // std::divides #include #include #include diff --git a/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp b/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp index 002d221e..cdb01862 100644 --- a/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp +++ b/boost/spirit/home/classic/core/non_terminal/impl/grammar.ipp @@ -286,7 +286,7 @@ struct grammar_definition helper_list_t& helpers = grammartract_helper_list::do_(self); -# if defined(BOOST_INTEL_CXX_VERSION) +# if (defined(BOOST_INTEL_CXX_VERSION) || (__cplusplus >= 201703L)) typedef typename helper_list_t::vector_t::reverse_iterator iterator_t; for (iterator_t i = helpers.rbegin(); i != helpers.rend(); ++i) -- 2.20.1