5 * Hewlett-Packard Company
7 * Copyright (c) 1996,1997
8 * Silicon Graphics Computer Systems, Inc.
11 * Moscow Center for SPARC Technology
16 * This material is provided "as is", with absolutely no warranty expressed
17 * or implied. Any use is at your own risk.
19 * Permission to use or copy this software for any purpose is hereby granted
20 * without fee, provided the above notices are retained on all copies.
21 * Permission to modify the code and to distribute modified code is granted,
22 * provided the above notices are retained, and a notice that the code was
23 * modified is included with the above copyright notice.
26 #ifndef _STLP_SLIST_BASE_C
27 #define _STLP_SLIST_BASE_C
29 #ifndef _STLP_INTERNAL_SLIST_BASE_H
30 # include <stl/_slist_base.h>
35 _STLP_MOVE_TO_PRIV_NAMESPACE
37 template <class _Dummy
>
38 _Slist_node_base
* _STLP_CALL
39 _Sl_global
<_Dummy
>::__previous(_Slist_node_base
* __head
,
40 const _Slist_node_base
* __node
) {
41 while (__head
&& __head
->_M_next
!= __node
)
42 __head
= __head
->_M_next
;
46 template <class _Dummy
>
48 _Sl_global
<_Dummy
>::__splice_after(_Slist_node_base
* __pos
, _Slist_node_base
* __head
) {
49 _Slist_node_base
* __before_last
= __previous(__head
, 0);
50 if (__before_last
!= __head
) {
51 _Slist_node_base
* __after
= __pos
->_M_next
;
52 __pos
->_M_next
= __head
->_M_next
;
54 __before_last
->_M_next
= __after
;
58 template <class _Dummy
>
60 _Sl_global
<_Dummy
>::__splice_after(_Slist_node_base
* __pos
,
61 _Slist_node_base
* __before_first
,
62 _Slist_node_base
* __before_last
) {
63 if (__pos
!= __before_first
&& __pos
!= __before_last
) {
64 _Slist_node_base
* __first
= __before_first
->_M_next
;
65 _Slist_node_base
* __after
= __pos
->_M_next
;
66 __before_first
->_M_next
= __before_last
->_M_next
;
67 __pos
->_M_next
= __first
;
68 __before_last
->_M_next
= __after
;
72 template <class _Dummy
>
73 _Slist_node_base
* _STLP_CALL
74 _Sl_global
<_Dummy
>::__reverse(_Slist_node_base
* __node
) {
75 _Slist_node_base
* __result
= __node
;
76 __node
= __node
->_M_next
;
77 __result
->_M_next
= 0;
79 _Slist_node_base
* __next
= __node
->_M_next
;
80 __node
->_M_next
= __result
;
87 template <class _Dummy
>
89 _Sl_global
<_Dummy
>::size(_Slist_node_base
* __node
) {
91 for ( ; __node
!= 0; __node
= __node
->_M_next
)
96 _STLP_MOVE_TO_STD_NAMESPACE
100 #endif /* _STLP_SLIST_BASE_C */