• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  *
3  * Copyright (c) 1996,1997
4  * Silicon Graphics Computer Systems, Inc.
5  *
6  * Copyright (c) 1997
7  * Moscow Center for SPARC Technology
8  *
9  * Copyright (c) 1999
10  * Boris Fomitchev
11  *
12  * This material is provided "as is", with absolutely no warranty expressed
13  * or implied. Any use is at your own risk.
14  *
15  * Permission to use or copy this software for any purpose is hereby granted
16  * without fee, provided the above notices are retained on all copies.
17  * Permission to modify the code and to distribute modified code is granted,
18  * provided the above notices are retained, and a notice that the code was
19  * modified is included with the above copyright notice.
20  *
21  */
22 
23 /* NOTE: This is an internal header file, included by other STL headers.
24  *   You should not attempt to use it directly.
25  */
26 
27 #ifndef _STLP_INTERNAL_SLIST_BASE_H
28 #define _STLP_INTERNAL_SLIST_BASE_H
29 
30 #ifndef _STLP_INTERNAL_CSTDDEF
31 #  include <stl/_cstddef.h>
32 #endif
33 
34 _STLP_BEGIN_NAMESPACE
35 
36 _STLP_MOVE_TO_PRIV_NAMESPACE
37 
38 struct _Slist_node_base {
39   _Slist_node_base* _M_next;
40 };
41 
42 inline _Slist_node_base*
__slist_make_link(_Slist_node_base * __prev_node,_Slist_node_base * __new_node)43 __slist_make_link(_Slist_node_base* __prev_node,
44                   _Slist_node_base* __new_node) {
45   __new_node->_M_next = __prev_node->_M_next;
46   __prev_node->_M_next = __new_node;
47   return __new_node;
48 }
49 
50 
51 template <class _Dummy>
52 class _Sl_global {
53 public:
54   // those used to be global functions
55   // moved here to reduce code bloat without templatizing _Slist_iterator_base
56   static size_t _STLP_CALL size(_Slist_node_base* __node);
57   static _Slist_node_base* _STLP_CALL __reverse(_Slist_node_base* __node);
58   static void _STLP_CALL __splice_after(_Slist_node_base* __pos,
59                                         _Slist_node_base* __before_first,
60                                         _Slist_node_base* __before_last);
61 
62   static void _STLP_CALL __splice_after(_Slist_node_base* __pos, _Slist_node_base* __head);
63 
64   static _Slist_node_base* _STLP_CALL __previous(_Slist_node_base* __head,
65                                                  const _Slist_node_base* __node);
__previous(const _Slist_node_base * __head,const _Slist_node_base * __node)66   static const _Slist_node_base* _STLP_CALL __previous(const _Slist_node_base* __head,
67                                                        const _Slist_node_base* __node) {
68     return _Sl_global<_Dummy>::__previous(__CONST_CAST(_Slist_node_base*, __head), __node);
69   }
70 };
71 
72 #if defined (_STLP_USE_TEMPLATE_EXPORT)
73 _STLP_EXPORT_TEMPLATE_CLASS _Sl_global<bool>;
74 #endif
75 
76 typedef _Sl_global<bool> _Sl_global_inst;
77 
78 _STLP_MOVE_TO_STD_NAMESPACE
79 
80 _STLP_END_NAMESPACE
81 
82 #if !defined (_STLP_LINK_TIME_INSTANTIATION) && defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
83 #  include <stl/_slist_base.c>
84 #endif
85 
86 #endif /* _STLP_INTERNAL_SLIST_BASE_H */
87 
88 // Local Variables:
89 // mode:C++
90 // End:
91