summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/include/ext
diff options
context:
space:
mode:
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-29 14:57:35 +0000
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>2014-01-29 14:57:35 +0000
commit7deb91c75a1c9de5bf46a5c959e5e709173ee639 (patch)
tree9e1fd6bd9e76ef396f73230c2bc16361ea341289 /libstdc++-v3/include/ext
parentb904104cb8c81fcd196aa64cde69663157de4be0 (diff)
downloadppe42-gcc-7deb91c75a1c9de5bf46a5c959e5e709173ee639.tar.gz
ppe42-gcc-7deb91c75a1c9de5bf46a5c959e5e709173ee639.zip
* include/bits/alloc_traits.h (allocator_traits::_S_allocate): Do
not use varargs when argument could be non-POD. (__alloctr_rebind_helper): Eliminate static const bool member by using true_type and false_type. (allocator_traits::__allocate_helper): Likewise. (allocator_traits::__construct_helper): Likewise. (allocator_traits::__destroy_helper): Likewise. (allocator_traits::__maxsize_helper): Likewise. (allocator_traits::__select_helper): Likewise. * include/bits/ptr_traits.h (__ptrtr_rebind_helper): Likewise. * include/bits/stl_tree.h (_Rb_tree::operator=(const _Rb_tree&)): Remove redundant condition. * include/bits/stl_vector.h (vector::operator=(const vector&)): Likewise. (_Vector_impl::_M_allocate, _Vector_impl::_M_deallocate): Use indirection through __alloc_traits. * include/ext/alloc_traits.h (__allocator_always_compares_equal): Eliminate static const bool members by using true_type and false_type. (__gnu_cxx::__alloc_traits::__is_custom_pointer): Optimize. * testsuite/util/testsuite_allocator.h (PointerBase): Define. * testsuite/20_util/allocator_traits/members/allocate_hint_nonpod.cc: New. * testsuite/20_util/allocator_traits/requirements/typedefs2.cc: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207240 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/include/ext')
-rw-r--r--libstdc++-v3/include/ext/alloc_traits.h51
1 files changed, 12 insertions, 39 deletions
diff --git a/libstdc++-v3/include/ext/alloc_traits.h b/libstdc++-v3/include/ext/alloc_traits.h
index 26e457ff253..14fbc4359ec 100644
--- a/libstdc++-v3/include/ext/alloc_traits.h
+++ b/libstdc++-v3/include/ext/alloc_traits.h
@@ -44,73 +44,47 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
#if __cplusplus >= 201103L
template<typename _Alloc>
- struct __allocator_always_compares_equal
- { static const bool value = false; };
-
- template<typename _Alloc>
- const bool __allocator_always_compares_equal<_Alloc>::value;
+ struct __allocator_always_compares_equal : std::false_type { };
template<typename _Tp>
struct __allocator_always_compares_equal<std::allocator<_Tp>>
- { static const bool value = true; };
-
- template<typename _Tp>
- const bool __allocator_always_compares_equal<std::allocator<_Tp>>::value;
+ : std::true_type { };
template<typename, typename> struct array_allocator;
template<typename _Tp, typename _Array>
struct __allocator_always_compares_equal<array_allocator<_Tp, _Array>>
- { static const bool value = true; };
-
- template<typename _Tp, typename _Array>
- const bool
- __allocator_always_compares_equal<array_allocator<_Tp, _Array>>::value;
+ : std::true_type { };
template<typename> struct bitmap_allocator;
template<typename _Tp>
struct __allocator_always_compares_equal<bitmap_allocator<_Tp>>
- { static const bool value = true; };
-
- template<typename _Tp>
- const bool __allocator_always_compares_equal<bitmap_allocator<_Tp>>::value;
+ : std::true_type { };
template<typename> struct malloc_allocator;
template<typename _Tp>
struct __allocator_always_compares_equal<malloc_allocator<_Tp>>
- { static const bool value = true; };
-
- template<typename _Tp>
- const bool __allocator_always_compares_equal<malloc_allocator<_Tp>>::value;
+ : std::true_type { };
template<typename> struct mt_allocator;
template<typename _Tp>
struct __allocator_always_compares_equal<mt_allocator<_Tp>>
- { static const bool value = true; };
-
- template<typename _Tp>
- const bool __allocator_always_compares_equal<mt_allocator<_Tp>>::value;
+ : std::true_type { };
template<typename> struct new_allocator;
template<typename _Tp>
struct __allocator_always_compares_equal<new_allocator<_Tp>>
- { static const bool value = true; };
-
- template<typename _Tp>
- const bool __allocator_always_compares_equal<new_allocator<_Tp>>::value;
+ : std::true_type { };
template<typename> struct pool_allocator;
template<typename _Tp>
struct __allocator_always_compares_equal<pool_allocator<_Tp>>
- { static const bool value = true; };
-
- template<typename _Tp>
- const bool __allocator_always_compares_equal<pool_allocator<_Tp>>::value;
+ : std::true_type { };
#endif
/**
@@ -131,7 +105,7 @@ template<typename _Alloc>
typedef typename _Base_type::const_pointer const_pointer;
typedef typename _Base_type::size_type size_type;
typedef typename _Base_type::difference_type difference_type;
- // C++0x allocators do not define reference or const_reference
+ // C++11 allocators do not define reference or const_reference
typedef value_type& reference;
typedef const value_type& const_reference;
using _Base_type::allocate;
@@ -142,10 +116,9 @@ template<typename _Alloc>
private:
template<typename _Ptr>
- struct __is_custom_pointer
- : std::integral_constant<bool, std::is_same<pointer, _Ptr>::value
- && !std::is_pointer<_Ptr>::value>
- { };
+ using __is_custom_pointer
+ = std::__and_<std::is_same<pointer, _Ptr>,
+ std::__not_<std::is_pointer<_Ptr>>>;
public:
// overload construct for non-standard pointer types
OpenPOWER on IntegriCloud