vector header

From Cppwiki

(Redirected from vector)
Jump to: navigation, search


<vector> is a C++ Standard Library #include. It is responsible for defining std::vector and some related functionality.

Contents

Operators

 template<typename T, typename Alloc = allocator<T> >
   bool operator==(vector<T, Alloc> const &, vector<T, Alloc> const &);
 template<typename T, typename Alloc = allocator<T> >
   bool operator!=(vector<T, Alloc> const &, vector<T, Alloc> const &);
 template<typename T, typename Alloc = allocator<T> >
   bool operator<(vector<T, Alloc> const &, vector<T, Alloc> const &);
 template<typename T, typename Alloc = allocator<T> >
   bool operator<=(vector<T, Alloc> const &, vector<T, Alloc> const &);
 template<typename T, typename Alloc = allocator<T> >
   bool operator>(vector<T, Alloc> const &, vector<T, Alloc> const &);
 template<typename T, typename Alloc = allocator<T> >
   bool operator>=(vector<T, Alloc> const &, vector<T, Alloc> const &);

std::vector class

 The std::vector class template is one of the standard containers defined by the C++ Standard Library.  It acts as a dynamic (resizable) array/

typedefs

 value_type
 allocator
 const_iterator
 const_reverse_iterator
 iterator
 reverse_iterator
 const_pointer
 const_reference
 pointer
 reference
 difference_type
 size_type

constructors

 vector()
 explicit vector(Alloc & alloc);
 explicit vector(size_type count);
 vector(size_type count, T const & value);
 vector(size_type count, T const & value, Alloc & alloc);
 vector(vector const & other);
 template<typename InputIter>
   vector(InputIter first, InputIter last);
 template<typename InputIter>
   vector(InputIter first, InputIter last, Alloc const & alloc);

member operators

 operator[](int index) - Retreive the element at index, is not required to do range checks.

other member functions

 assign
 at
 back
 begin
 capacity
 clear
 empty
 end
 erase
 front
 get_allocator
 insert
 max_size
 pop_back
 push_back
 rbegin
 rend
 reserve
 resize
 size
 swap

Function specializations

 std::swap - O(1) swap of two std::vector objects.

Type specializations

 std::vector<bool>
Personal tools