mirror of git://gcc.gnu.org/git/gcc.git
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
This commit is contained in:
parent
54dbf90c37
commit
314efb66cf
|
|
@ -19,6 +19,12 @@
|
||||||
Likewise.
|
Likewise.
|
||||||
* testsuite/experimental/string_view/operations/to_string/1.cc: New.
|
* 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 <jwakely@redhat.com>
|
2014-05-30 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
* testsuite/lib/libstdc++.exp (libstdc++_init): Adjust regexp to
|
* testsuite/lib/libstdc++.exp (libstdc++_init): Adjust regexp to
|
||||||
|
|
|
||||||
|
|
@ -45,35 +45,33 @@ _GLIBCXX_HAS_NESTED_TYPE(allocator_type)
|
||||||
template<typename _Tp, typename _Alloc,
|
template<typename _Tp, typename _Alloc,
|
||||||
bool = __has_allocator_type<_Tp>::value>
|
bool = __has_allocator_type<_Tp>::value>
|
||||||
struct __uses_allocator_helper
|
struct __uses_allocator_helper
|
||||||
: public false_type { };
|
: false_type { };
|
||||||
|
|
||||||
template<typename _Tp, typename _Alloc>
|
template<typename _Tp, typename _Alloc>
|
||||||
struct __uses_allocator_helper<_Tp, _Alloc, true>
|
struct __uses_allocator_helper<_Tp, _Alloc, true>
|
||||||
: public integral_constant<bool, is_convertible<_Alloc,
|
: is_convertible<_Alloc, typename _Tp::allocator_type>::type
|
||||||
typename _Tp::allocator_type>::value>
|
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
/// [allocator.uses.trait]
|
/// [allocator.uses.trait]
|
||||||
template<typename _Tp, typename _Alloc>
|
template<typename _Tp, typename _Alloc>
|
||||||
struct uses_allocator
|
struct uses_allocator
|
||||||
: public integral_constant<bool,
|
: __uses_allocator_helper<_Tp, _Alloc>::type
|
||||||
__uses_allocator_helper<_Tp, _Alloc>::value>
|
|
||||||
{ };
|
{ };
|
||||||
|
|
||||||
template<typename _Tp, typename _Alloc, typename... _Args>
|
|
||||||
struct __uses_allocator_arg
|
|
||||||
: is_constructible<_Tp, _Alloc, _Args...>
|
|
||||||
{ static_assert( uses_allocator<_Tp, _Alloc>::value, "uses allocator" ); };
|
|
||||||
|
|
||||||
struct __uses_alloc_base { };
|
struct __uses_alloc_base { };
|
||||||
|
|
||||||
struct __uses_alloc0 : __uses_alloc_base
|
struct __uses_alloc0 : __uses_alloc_base
|
||||||
{ struct _Anything { _Anything(...) { } } _M_a; };
|
{
|
||||||
|
struct _Sink { void operator=(const void*) { } } _M_a;
|
||||||
|
};
|
||||||
|
|
||||||
template<typename _Alloc>
|
template<typename _Alloc>
|
||||||
struct __uses_alloc1 : __uses_alloc_base { const _Alloc* _M_a; };
|
struct __uses_alloc1 : __uses_alloc_base { const _Alloc* _M_a; };
|
||||||
|
|
||||||
template<typename _Alloc>
|
template<typename _Alloc>
|
||||||
struct __uses_alloc2 : __uses_alloc_base { const _Alloc* _M_a; };
|
struct __uses_alloc2 : __uses_alloc_base { const _Alloc* _M_a; };
|
||||||
|
|
||||||
template<bool, typename _Alloc, typename... _Args>
|
template<bool, typename _Tp, typename _Alloc, typename... _Args>
|
||||||
struct __uses_alloc;
|
struct __uses_alloc;
|
||||||
|
|
||||||
template<typename _Tp, typename _Alloc, typename... _Args>
|
template<typename _Tp, typename _Alloc, typename... _Args>
|
||||||
|
|
@ -89,15 +87,14 @@ _GLIBCXX_HAS_NESTED_TYPE(allocator_type)
|
||||||
: __uses_alloc0 { };
|
: __uses_alloc0 { };
|
||||||
|
|
||||||
template<typename _Tp, typename _Alloc, typename... _Args>
|
template<typename _Tp, typename _Alloc, typename... _Args>
|
||||||
struct __uses_alloc_impl
|
using __uses_alloc_t =
|
||||||
: __uses_alloc<uses_allocator<_Tp, _Alloc>::value, _Tp, _Alloc, _Args...>
|
__uses_alloc<uses_allocator<_Tp, _Alloc>::value, _Tp, _Alloc, _Args...>;
|
||||||
{ };
|
|
||||||
|
|
||||||
template<typename _Tp, typename _Alloc, typename... _Args>
|
template<typename _Tp, typename _Alloc, typename... _Args>
|
||||||
__uses_alloc_impl<_Tp, _Alloc, _Args...>
|
inline __uses_alloc_t<_Tp, _Alloc, _Args...>
|
||||||
__use_alloc(const _Alloc& __a)
|
__use_alloc(const _Alloc& __a)
|
||||||
{
|
{
|
||||||
__uses_alloc_impl<_Tp, _Alloc, _Args...> __ret;
|
__uses_alloc_t<_Tp, _Alloc, _Args...> __ret;
|
||||||
__ret._M_a = &__a;
|
__ret._M_a = &__a;
|
||||||
return __ret;
|
return __ret;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue