From 314efb66cf1d5f8eaa3676eee83ac7787d4e09d7 Mon Sep 17 00:00:00 2001 From: Jonathan Wakely Date: Sun, 1 Jun 2014 23:35:42 +0100 Subject: uses_allocator.h (__uses_allocator_helper): Simplify. * include/bits/uses_allocator.h (__uses_allocator_helper): Simplify. (__uses_allocator_arg): Remove unused type. (__uses_alloc0): Turn into a trivial type. (__uses_alloc): Add missing template parameter in primary template. (__uses_alloc_impl): Rename to __uses_alloc_t. From-SVN: r211121 --- libstdc++-v3/ChangeLog | 6 ++++++ libstdc++-v3/include/bits/uses_allocator.h | 31 ++++++++++++++---------------- 2 files changed, 20 insertions(+), 17 deletions(-) (limited to 'libstdc++-v3') diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 4d69c25..56e7d34 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -19,6 +19,12 @@ Likewise. * testsuite/experimental/string_view/operations/to_string/1.cc: New. + * include/bits/uses_allocator.h (__uses_allocator_helper): Simplify. + (__uses_allocator_arg): Remove unused type. + (__uses_alloc0): Turn into a trivial type. + (__uses_alloc): Add missing template parameter in primary template. + (__uses_alloc_impl): Rename to __uses_alloc_t. + 2014-05-30 Jonathan Wakely * testsuite/lib/libstdc++.exp (libstdc++_init): Adjust regexp to diff --git a/libstdc++-v3/include/bits/uses_allocator.h b/libstdc++-v3/include/bits/uses_allocator.h index 10131c0..7281508 100644 --- a/libstdc++-v3/include/bits/uses_allocator.h +++ b/libstdc++-v3/include/bits/uses_allocator.h @@ -45,35 +45,33 @@ _GLIBCXX_HAS_NESTED_TYPE(allocator_type) template::value> struct __uses_allocator_helper - : public false_type { }; + : false_type { }; template struct __uses_allocator_helper<_Tp, _Alloc, true> - : public integral_constant::value> + : is_convertible<_Alloc, typename _Tp::allocator_type>::type { }; /// [allocator.uses.trait] template struct uses_allocator - : public integral_constant::value> + : __uses_allocator_helper<_Tp, _Alloc>::type { }; - template - struct __uses_allocator_arg - : is_constructible<_Tp, _Alloc, _Args...> - { static_assert( uses_allocator<_Tp, _Alloc>::value, "uses allocator" ); }; - struct __uses_alloc_base { }; + struct __uses_alloc0 : __uses_alloc_base - { struct _Anything { _Anything(...) { } } _M_a; }; + { + struct _Sink { void operator=(const void*) { } } _M_a; + }; + template struct __uses_alloc1 : __uses_alloc_base { const _Alloc* _M_a; }; + template struct __uses_alloc2 : __uses_alloc_base { const _Alloc* _M_a; }; - template + template struct __uses_alloc; template @@ -89,15 +87,14 @@ _GLIBCXX_HAS_NESTED_TYPE(allocator_type) : __uses_alloc0 { }; template - struct __uses_alloc_impl - : __uses_alloc::value, _Tp, _Alloc, _Args...> - { }; + using __uses_alloc_t = + __uses_alloc::value, _Tp, _Alloc, _Args...>; template - __uses_alloc_impl<_Tp, _Alloc, _Args...> + inline __uses_alloc_t<_Tp, _Alloc, _Args...> __use_alloc(const _Alloc& __a) { - __uses_alloc_impl<_Tp, _Alloc, _Args...> __ret; + __uses_alloc_t<_Tp, _Alloc, _Args...> __ret; __ret._M_a = &__a; return __ret; } -- cgit v1.1