ReactOS 0.4.15-dev-7934-g1dc8d80
_slist_base.c
Go to the documentation of this file.
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
34
36
37template <class _Dummy>
40 const _Slist_node_base* __node) {
41 while (__head && __head->_M_next != __node)
42 __head = __head->_M_next;
43 return __head;
44}
45
46template <class _Dummy>
47void _STLP_CALL
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
58template <class _Dummy>
59void _STLP_CALL
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
72template <class _Dummy>
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
87template <class _Dummy>
88size_t _STLP_CALL
90 size_t __result = 0;
91 for ( ; __node != 0; __node = __node->_M_next)
92 ++__result;
93 return __result;
94}
95
97
99
100#endif /* _STLP_SLIST_BASE_C */
101
102// Local Variables:
103// mode:C++
104// End:
#define _STLP_CALL
Definition: _bc.h:131
static size_t _STLP_CALL size(_Slist_node_base *__node)
Definition: _slist_base.c:89
static _Slist_node_base *_STLP_CALL __previous(_Slist_node_base *__head, const _Slist_node_base *__node)
Definition: _slist_base.c:39
static void _STLP_CALL __splice_after(_Slist_node_base *__pos, _Slist_node_base *__before_first, _Slist_node_base *__before_last)
Definition: _slist_base.c:60
static _Slist_node_base *_STLP_CALL __reverse(_Slist_node_base *__node)
Definition: _slist_base.c:74
#define _STLP_MOVE_TO_STD_NAMESPACE
Definition: features.h:525
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
#define _STLP_END_NAMESPACE
Definition: features.h:503
#define _STLP_MOVE_TO_PRIV_NAMESPACE
Definition: features.h:524
_Slist_node_base * _M_next
Definition: _slist_base.h:39