/* Copyright 2021 Glen Joseph Fernandes (glenjofe@gmail.com) Distributed under the Boost Software License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) */ #include #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && \ (!defined(BOOST_GCC) || (BOOST_GCC >= 40800)) && \ (!defined(BOOST_MSVC) || (BOOST_MSVC >= 1900)) #include #include template struct valid { typedef void type; }; #if !defined(BOOST_GCC) || (BOOST_GCC >= 50000) template struct has_rebind { static const bool value = false; }; template struct has_rebind >::type> { static const bool value = true; }; #else template class T, class U> using defer = T; template using rebind = defer; template class = rebind, class = void> struct has_rebind { static const bool value = false; }; template class R> struct has_rebind >::type> { static const bool value = true; }; #endif struct P1 { }; struct P2 { typedef int element_type; }; struct P3 { typedef int element_type; template using rebind = P3; }; template struct S { typedef T element_type; }; typedef S P4; int main() { BOOST_TEST((!has_rebind, char>::value)); BOOST_TEST((!has_rebind, char>::value)); BOOST_TEST((has_rebind, char>::value)); BOOST_TEST((has_rebind, char>::value)); BOOST_TEST((has_rebind, char>::value)); return boost::report_errors(); } #else int main() { return 0; } #endif