ptr_list.rst 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. ++++++++++++++++++++++++++++++++++
  2. |Boost| Pointer Container Library
  3. ++++++++++++++++++++++++++++++++++
  4. .. |Boost| image:: boost.png
  5. Class ``ptr_list``
  6. ------------------
  7. A ``ptr_list<T>`` is a pointer container that uses an underlying ``std:list<void*>``
  8. to store the pointers.
  9. **Hierarchy:**
  10. - `reversible_ptr_container <reversible_ptr_container.html>`_
  11. - `ptr_sequence_adapter <ptr_sequence_adapter.html>`_
  12. - `ptr_vector <ptr_vector.html>`_
  13. - ``ptr_list``
  14. - `ptr_deque <ptr_deque.html>`_
  15. - `ptr_array <ptr_array.html>`_
  16. **Navigate:**
  17. - `home <ptr_container.html>`_
  18. - `reference <reference.html>`_
  19. **Synopsis:**
  20. .. parsed-literal::
  21. namespace boost
  22. {
  23. template
  24. <
  25. class T,
  26. class CloneAllocator = heap_clone_allocator,
  27. class Allocator = std::allocator<void*>
  28. >
  29. class ptr_list : public ptr_sequence_adapter
  30. <
  31. T,
  32. std::list<void*,Allocator>,
  33. CloneAllocator
  34. >
  35. {
  36. public: // modifiers_
  37. void push_front( T* x );
  38. template< class U >
  39. void push_front( compatible-smart-ptr<U> x );
  40. auto_type pop_front();
  41. public: // `list operations`_
  42. void reverse();
  43. }; // class 'ptr_list'
  44. } // namespace 'boost'
  45. Semantics
  46. ---------
  47. .. _modifiers:
  48. Semantics: modifiers
  49. ^^^^^^^^^^^^^^^^^^^^
  50. - ``void push_front( T* x );``
  51. - Requirements: ``x != 0``
  52. - Effects: Inserts the pointer into container and takes ownership of it
  53. - Throws: ``bad_pointer`` if ``x == 0``
  54. - Exception safety: Strong guarantee
  55. - ``template< class U > void push_front( compatible-smart-ptr<U> x );``
  56. - Effects: ``push_front( x.release() );``
  57. ..
  58. - ``void push_front( const T& x );``
  59. - Effects: push_front( allocate_clone( x ) );
  60. - Exception safety: Strong guarantee
  61. - ``auto_type pop_front():``
  62. - Requirements:``not empty()``
  63. - Effects: Removes the first element in the container
  64. - Postconditions: ``size()`` is one less
  65. - Throws: ``bad_ptr_container_operation`` if ``empty() == true``
  66. - Exception safety: Strong guarantee
  67. .. _`list operations`:
  68. Semantics: list operations
  69. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  70. ..
  71. - ``void splice( iterator before, ptr_list& x );``
  72. - Requirements:``&x != this``
  73. - Effects: inserts the all of ``x``'s elements before ``before``
  74. - Postconditions: ``x.empty()``
  75. - Throws: nothing
  76. - Remark: prefer this to ``transfer( before, x );``
  77. - ``void splice( iterator before, ptr_list& x, iterator i );``
  78. - Not ready yet
  79. - ``void splice( iterator before, ptr_list& x, iterator first, iterator last );``
  80. - Not ready yet
  81. - ``void merge( ptr_list& x );``
  82. - Not ready yet
  83. - ``template< typename Compare >
  84. void merge( ptr_list& x, Compare comp );``
  85. - Not ready yet
  86. - ``void reverse();``
  87. - Effects: reverses the underlying sequence
  88. - Throws: nothing
  89. .. raw:: html
  90. <hr>
  91. :Copyright: Thorsten Ottosen 2004-2006. Use, modification and distribution is subject to the Boost Software License, Version 1.0 (see LICENSE_1_0.txt__).
  92. __ http://www.boost.org/LICENSE_1_0.txt