This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
[v3] Minor tweak to forward_list
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: Gcc Patch List <gcc-patches at gcc dot gnu dot org>
- Cc: libstdc++ <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 16 Apr 2009 13:58:14 +0200
- Subject: [v3] Minor tweak to forward_list
Hi,
tested x86_64-linux, committed to mainline. I'm tempted to apply it to
the branch too, should be very safe and reduces unnecessary divergence.
Paolo.
////////////////
2009-04-16 Paolo Carlini <paolo.carlini@oracle.com>
* include/bits/forward_list.h: Remove default std::allocator<_Tp>
from base classes.
* testsuite/23_containers/forward_list/capacity/1.cc: Adjust.
Index: include/bits/forward_list.h
===================================================================
--- include/bits/forward_list.h (revision 146101)
+++ include/bits/forward_list.h (working copy)
@@ -81,7 +81,7 @@
* This is just a linked list with a data value in each node.
* There is a sorting utility method.
*/
- template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+ template<typename _Tp, typename _Alloc>
struct _Fwd_list_node : public _Fwd_list_node_base<_Alloc>
{
typedef typename _Alloc::template rebind<_Fwd_list_node<_Tp, _Alloc> >
@@ -104,7 +104,7 @@
*
* All the functions are op overloads.
*/
- template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+ template<typename _Tp, typename _Alloc>
struct _Fwd_list_iterator
{
typedef _Fwd_list_iterator<_Tp, _Alloc> _Self;
@@ -171,7 +171,7 @@
*
* All the functions are op overloads.
*/
- template<typename _Tp, typename _Alloc = std::allocator<_Tp> >
+ template<typename _Tp, typename _Alloc>
struct _Fwd_list_const_iterator
{
typedef _Fwd_list_const_iterator<_Tp, _Alloc> _Self;
@@ -240,7 +240,7 @@
/**
* @brief Forward list iterator equality comparison.
*/
- template<typename _Tp,class _Alloc>
+ template<typename _Tp, typename _Alloc>
inline bool
operator==(const _Fwd_list_iterator<_Tp, _Alloc>& __x,
const _Fwd_list_const_iterator<_Tp, _Alloc>& __y)
@@ -249,7 +249,7 @@
/**
* @brief Forward list iterator inequality comparison.
*/
- template<typename _Tp,class _Alloc>
+ template<typename _Tp, typename _Alloc>
inline bool
operator!=(const _Fwd_list_iterator<_Tp, _Alloc>& __x,
const _Fwd_list_const_iterator<_Tp, _Alloc>& __y)
@@ -258,7 +258,7 @@
/**
* @brief Base class for %forward_list.
*/
- template<typename _Tp, typename _Alloc = allocator<_Tp> >
+ template<typename _Tp, typename _Alloc>
struct _Fwd_list_base
{
protected:
Index: testsuite/23_containers/forward_list/capacity/1.cc
===================================================================
--- testsuite/23_containers/forward_list/capacity/1.cc (revision 146101)
+++ testsuite/23_containers/forward_list/capacity/1.cc (working copy)
@@ -38,8 +38,9 @@
fld.resize(0);
VERIFY(fld.empty() == true);
- VERIFY( fld.max_size()
- == std::allocator<std::_Fwd_list_node<double> >().max_size() );
+ VERIFY( (fld.max_size()
+ == std::allocator<std::_Fwd_list_node<double,
+ std::allocator<double> > >().max_size()) );
}
int