//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // template // struct allocator_traits // { // template using rebind_alloc = Alloc::rebind::other | Alloc; // ... // }; #include #include template struct ReboundA {}; template struct A { typedef T value_type; template struct rebind {typedef ReboundA other;}; }; template struct ReboundB {}; template struct B { typedef T value_type; template struct rebind {typedef ReboundB other;}; }; template struct C { typedef T value_type; }; template struct D { typedef T value_type; }; template struct E { typedef T value_type; template struct rebind {typedef ReboundA otter;}; }; int main() { #ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES static_assert((std::is_same >::rebind_alloc, ReboundA >::value), ""); static_assert((std::is_same >::rebind_alloc, ReboundB >::value), ""); static_assert((std::is_same >::rebind_alloc, C >::value), ""); static_assert((std::is_same >::rebind_alloc, D >::value), ""); static_assert((std::is_same >::rebind_alloc, E >::value), ""); #else // _LIBCPP_HAS_NO_TEMPLATE_ALIASES static_assert((std::is_same >::rebind_alloc::other, ReboundA >::value), ""); static_assert((std::is_same >::rebind_alloc::other, ReboundB >::value), ""); static_assert((std::is_same >::rebind_alloc::other, C >::value), ""); static_assert((std::is_same >::rebind_alloc::other, D >::value), ""); static_assert((std::is_same >::rebind_alloc::other, E >::value), ""); #endif // _LIBCPP_HAS_NO_TEMPLATE_ALIASES }