@@ -333,6 +333,17 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
: public _Node_alloc_type
{
__detail::_List_node_base _M_node;
+#if _GLIBCXX_USE_CXX11_ABI
+ size_t _M_size;
+
+ // return the stored size
+ size_t _M_node_count() const { return _M_size; }
+#else
+ // count the number of nodes
+ size_t _M_node_count() const
+ { return _S_distance(_M_node._M_next, std::__addressof(_M_node)); }
+#endif
+
_List_impl()
: _Node_alloc_type(), _M_node()
{ }
@@ -350,24 +361,27 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
_List_impl _M_impl;
-#if _GLIBCXX_USE_CXX11_ABI
- size_t _M_size;
+ _List_node<_Tp>*
+ _M_get_node()
+ { return _M_impl._Node_alloc_type::allocate(1); }
+
+ void
+ _M_put_node(_List_node<_Tp>* __p) _GLIBCXX_NOEXCEPT
+ { _M_impl._Node_alloc_type::deallocate(__p, 1); }
- size_t _M_get_size() const { return _M_size; }
+#if _GLIBCXX_USE_CXX11_ABI
+ size_t _M_get_size() const { return _M_impl._M_size; }
- void _M_set_size(size_t __n) { _M_size = __n; }
+ void _M_set_size(size_t __n) { _M_impl._M_size = __n; }
- void _M_inc_size(size_t __n) { _M_size += __n; }
+ void _M_inc_size(size_t __n) { _M_impl._M_size += __n; }
- void _M_dec_size(size_t __n) { _M_size -= __n; }
+ void _M_dec_size(size_t __n) { _M_impl._M_size -= __n; }
size_t
_M_distance(const __detail::_List_node_base* __first,
const __detail::_List_node_base* __last) const
{ return _S_distance(__first, __last); }
-
- // return the stored size
- size_t _M_node_count() const { return _M_size; }
#else
// dummy implementations used when the size is not stored
size_t _M_get_size() const { return 0; }
@@ -375,23 +389,8 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
void _M_inc_size(size_t) { }
void _M_dec_size(size_t) { }
size_t _M_distance(const void*, const void*) const { return 0; }
-
- // count the number of nodes
- size_t _M_node_count() const
- {
- return _S_distance(_M_impl._M_node._M_next,
- std::__addressof(_M_impl._M_node));
- }
#endif
- _List_node<_Tp>*
- _M_get_node()
- { return _M_impl._Node_alloc_type::allocate(1); }
-
- void
- _M_put_node(_List_node<_Tp>* __p) _GLIBCXX_NOEXCEPT
- { _M_impl._Node_alloc_type::deallocate(__p, 1); }
-
public:
typedef _Alloc allocator_type;
@@ -941,7 +940,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER
/** Returns the number of elements in the %list. */
size_type
size() const _GLIBCXX_NOEXCEPT
- { return this->_M_node_count(); }
+ { return this->_M_impl._M_node_count(); }
/** Returns the size() of the largest possible %list. */
size_type