diff options
author | Eric Fiselier <eric@efcs.ca> | 2015-08-23 02:56:05 +0000 |
---|---|---|
committer | Eric Fiselier <eric@efcs.ca> | 2015-08-23 02:56:05 +0000 |
commit | bb2f28e15d3666b9316bf77ced071f16fa0fc70e (patch) | |
tree | f2eea5505346e29b58b3ec12fe5d13082707019e /include/memory | |
parent | d686dda62e7da9958c6b82716bb8480f83ff40d0 (diff) |
Recommit rL245802: Cleanup fancy pointer rebinding in list using __rebind_pointer.
Currently we need an #ifdef branch every time we use pointer traits to rebind a pointer because
it is done differently in C++11 and C++03. This patch introduces the __rebind_pointer utility to
clean this up.
Also add a test that list and it's iterators can be instantiated with incomplete element types.
git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@245806 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/memory')
-rw-r--r-- | include/memory | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/memory b/include/memory index 38ce433b2..9d214beb6 100644 --- a/include/memory +++ b/include/memory @@ -932,6 +932,15 @@ public: {return _VSTD::addressof(__r);} }; +template <class _From, class _To> +struct __rebind_pointer { +#ifndef _LIBCPP_HAS_NO_TEMPLATE_ALIASES + typedef typename pointer_traits<_From>::template rebind<_To> type; +#else + typedef typename pointer_traits<_From>::template rebind<_To>::other type; +#endif +}; + // allocator_traits namespace __has_pointer_type_imp |