Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Boost Pointer Container Library

Class ptr_vector

A ptr_list<T> is a pointer container that uses an underlying std:list<void*> to store the pointers.

See also:



namespace boost

        class T, 
        class CloneAllocator = heap_clone_allocator,
        class Allocator      = std::allocator<void*>
    class ptr_list : public ptr_sequence_adapter
    public: // modifiers
        void                push_front( T* x );
        auto_type           pop_front();
    public: // list operations
        void  reverse();

    }; // class 'ptr_list'

} // namespace 'boost'  


Semantics: modifiers

  • void push_front( T* x );

    • Requirements: x != 0
    • Effects: Inserts the pointer into container and takes ownership of it
    • Throws: bad_pointer if x == 0
    • Exception safety: Strong guarantee
  • auto_type pop_front():

    • Requirements:not empty()
    • Effects: Removes the first element in the container
    • Postconditions: size() is one less
    • Throws: bad_ptr_container_operation if empty() == true
    • Exception safety: Strong guarantee

Semantics: list operations

  • void reverse();

    • Effects: reverses the underlying sequence
    • Throws: nothing
copyright:Thorsten Ottosen 2004-2005.