Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

<vector>

 

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

Defines the container template class vector and several supporting templates.

The vector is a container that organizes elements of a given type in a linear sequence. It enables fast random access to any element, and dynamic additions and removals to and from the sequence. The vector is the preferred container for a sequence when random-access performance is at a premium.

For more information about the class vector, see vector Class. For information about the specialization vector<bool>, see vector<bool> Class.

namespace std {  
template <class Type, class Allocator>  
class vector;  
template <class Allocator>  
class vector<bool>;  
 
template <class Allocator>  
struct hash<vector<bool, Allocator>>;  
 // TEMPLATE FUNCTIONS  
template <class Type, class Allocator>  
bool operator== (
    const vector<Type, Allocator>& left,  
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>  
bool operator!= (
    const vector<Type, Allocator>& left,  
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>  
bool operator<(
    const vector<Type, Allocator>& left,  
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>  
bool operator> (
    const vector<Type, Allocator>& left,  
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>  
bool operator<= (
    const vector<Type, Allocator>& left,  
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>  
bool operator>= (
    const vector<Type, Allocator>& left,  
    const vector<Type, Allocator>& right);

template <class Type, class Allocator>  
void swap (
    vector<Type, Allocator>& left,  
    vector<Type, Allocator>& right);

}  // namespace std  

Parameters

Type
The template parameter for the type of data stored in the vector.

Allocator
The template parameter for the stored allocator object responsible for memory allocation and deallocation.

left
The first (left) vector in a compare operation

right
The second (right) vector in a compare operation.

Operators

operator! =Tests if the vector object on the left side of the operator is not equal to the vector object on the right side.
operator<Tests if the vector object on the left side of the operator is less than the vector object on the right side.
operator<=Tests if the vector object on the left side of the operator is less than or equal to the vector object on the right side.
operator==Tests if the vector object on the left side of the operator is equal to the vector object on the right side.
operator>Tests if the vector object on the left side of the operator is greater than the vector object on the right side.
operator>=Tests if the vector object on the left side of the operator is greater than or equal to the vector object on the right side.

Classes

vector ClassA template class of sequence containers that arrange elements of a given type in a linear arrangement and allow fast random access to any element.

Specializations

vector<bool> ClassA full specialization of the template class vector for elements of type bool with an allocator for the underlying type used by the specialization.

Header: <vector>

Namespace: std

Header Files Reference
Thread Safety in the C++ Standard Library
Standard Template Library

Show:
© 2016 Microsoft