From 7100c05490ab286b4dded94c00dd05896baa5bf8 Mon Sep 17 00:00:00 2001 From: Glen Fernandes Date: Sun, 17 Jul 2022 09:47:38 -0400 Subject: [PATCH] In C++03 use rebind::other instead of rebind --- include/boost/core/pointer_traits.hpp | 8 ++++++++ test/pointer_traits_rebind_sfinae_test.cpp | 2 +- test/pointer_traits_sfinae_test.cpp | 9 ++++++++- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/include/boost/core/pointer_traits.hpp b/include/boost/core/pointer_traits.hpp index fbc76e7..7de7a8e 100644 --- a/include/boost/core/pointer_traits.hpp +++ b/include/boost/core/pointer_traits.hpp @@ -100,11 +100,19 @@ template struct ptr_rebind : ptr_transform { }; +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) template struct ptr_rebind >::type> { typedef typename T::template rebind type; }; +#else +template +struct ptr_rebind::other>::type> { + typedef typename T::template rebind::other type; +}; +#endif #if !defined(BOOST_NO_CXX11_DECLTYPE_N3276) template diff --git a/test/pointer_traits_rebind_sfinae_test.cpp b/test/pointer_traits_rebind_sfinae_test.cpp index d6ad087..8c7a1eb 100644 --- a/test/pointer_traits_rebind_sfinae_test.cpp +++ b/test/pointer_traits_rebind_sfinae_test.cpp @@ -56,7 +56,7 @@ struct P3 { typedef int element_type; template - struct rebind { }; + using rebind = P3; }; template diff --git a/test/pointer_traits_sfinae_test.cpp b/test/pointer_traits_sfinae_test.cpp index a7ae787..45c00d8 100644 --- a/test/pointer_traits_sfinae_test.cpp +++ b/test/pointer_traits_sfinae_test.cpp @@ -64,8 +64,15 @@ struct P2 { struct P3 { typedef int element_type; +#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) template - struct rebind { }; + using rebind = P3; +#else + template + struct rebind { + typedef P3 other; + }; +#endif }; template