_slist_base.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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. /* NOTE: This is an internal header file, included by other STL headers.
  23. * You should not attempt to use it directly.
  24. */
  25. #ifndef _STLP_INTERNAL_SLIST_BASE_H
  26. #define _STLP_INTERNAL_SLIST_BASE_H
  27. #ifndef _STLP_INTERNAL_CSTDDEF
  28. # include <stl/_cstddef.h>
  29. #endif
  30. _STLP_BEGIN_NAMESPACE
  31. _STLP_MOVE_TO_PRIV_NAMESPACE
  32. struct _Slist_node_base {
  33. _Slist_node_base* _M_next;
  34. };
  35. inline _Slist_node_base*
  36. __slist_make_link(_Slist_node_base* __prev_node,
  37. _Slist_node_base* __new_node) {
  38. __new_node->_M_next = __prev_node->_M_next;
  39. __prev_node->_M_next = __new_node;
  40. return __new_node;
  41. }
  42. template <class _Dummy>
  43. class _Sl_global {
  44. public:
  45. // those used to be global functions
  46. // moved here to reduce code bloat without templatizing _Slist_iterator_base
  47. static size_t _STLP_CALL size(_Slist_node_base* __node);
  48. static _Slist_node_base* _STLP_CALL __reverse(_Slist_node_base* __node);
  49. static void _STLP_CALL __splice_after(_Slist_node_base* __pos,
  50. _Slist_node_base* __before_first,
  51. _Slist_node_base* __before_last);
  52. static void _STLP_CALL __splice_after(_Slist_node_base* __pos, _Slist_node_base* __head);
  53. static _Slist_node_base* _STLP_CALL __previous(_Slist_node_base* __head,
  54. const _Slist_node_base* __node);
  55. static const _Slist_node_base* _STLP_CALL __previous(const _Slist_node_base* __head,
  56. const _Slist_node_base* __node) {
  57. return _Sl_global<_Dummy>::__previous(__CONST_CAST(_Slist_node_base*, __head), __node);
  58. }
  59. };
  60. #if defined (_STLP_USE_TEMPLATE_EXPORT)
  61. _STLP_EXPORT_TEMPLATE_CLASS _Sl_global<bool>;
  62. #endif
  63. typedef _Sl_global<bool> _Sl_global_inst;
  64. _STLP_MOVE_TO_STD_NAMESPACE
  65. _STLP_END_NAMESPACE
  66. #if !defined (_STLP_LINK_TIME_INSTANTIATION) && defined (_STLP_EXPOSE_GLOBALS_IMPLEMENTATION)
  67. # include <stl/_slist_base.c>
  68. #endif
  69. #endif /* _STLP_INTERNAL_SLIST_BASE_H */
  70. // Local Variables:
  71. // mode:C++
  72. // End: