[CLASSPNP] Fix MSVC build. Brought to you by Timo.
[reactos.git] / reactos / include / c++ / stlport / stl / _slist_base.c
1 /*
2 *
3 *
4 * Copyright (c) 1994
5 * Hewlett-Packard Company
6 *
7 * Copyright (c) 1996,1997
8 * Silicon Graphics Computer Systems, Inc.
9 *
10 * Copyright (c) 1997
11 * Moscow Center for SPARC Technology
12 *
13 * Copyright (c) 1999
14 * Boris Fomitchev
15 *
16 * This material is provided "as is", with absolutely no warranty expressed
17 * or implied. Any use is at your own risk.
18 *
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.
24 *
25 */
26 #ifndef _STLP_SLIST_BASE_C
27 #define _STLP_SLIST_BASE_C
28
29 #ifndef _STLP_INTERNAL_SLIST_BASE_H
30 # include <stl/_slist_base.h>
31 #endif
32
33 _STLP_BEGIN_NAMESPACE
34
35 _STLP_MOVE_TO_PRIV_NAMESPACE
36
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;
43 return __head;
44 }
45
46 template <class _Dummy>
47 void _STLP_CALL
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;
53 __head->_M_next = 0;
54 __before_last->_M_next = __after;
55 }
56 }
57
58 template <class _Dummy>
59 void _STLP_CALL
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;
69 }
70 }
71
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;
78 while(__node) {
79 _Slist_node_base* __next = __node->_M_next;
80 __node->_M_next = __result;
81 __result = __node;
82 __node = __next;
83 }
84 return __result;
85 }
86
87 template <class _Dummy>
88 size_t _STLP_CALL
89 _Sl_global<_Dummy>::size(_Slist_node_base* __node) {
90 size_t __result = 0;
91 for ( ; __node != 0; __node = __node->_M_next)
92 ++__result;
93 return __result;
94 }
95
96 _STLP_MOVE_TO_STD_NAMESPACE
97
98 _STLP_END_NAMESPACE
99
100 #endif /* _STLP_SLIST_BASE_C */
101
102 // Local Variables:
103 // mode:C++
104 // End: