[C/C++] vector api reference

Posted by [하늘이]
2016. 10. 21. 11:32 IT/C, C++
반응형

Example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <iostream>
#include <vector>
 
int main()
{
    // Create a vector containing integers
    std::vector<int> v = {75168};
 
    // Add two more integers to vector
    v.push_back(25);
    v.push_back(13);
 
    // Iterate and print values of vector
    for(int n : v) {
        std::cout << n << '\n';
    }
}
cs


Member Function Reference

Member functions

constructs the vector 
(public member function)
destructs the vector 
(public member function)
assigns values to the container 
(public member function)
assigns values to the container 
(public member function)
returns the associated allocator 
(public member function)
Element access
access specified element with bounds checking 
(public member function)
access specified element 
(public member function)
access the first element 
(public member function)
access the last element 
(public member function)
(C++11)
direct access to the underlying array 
(public member function)
Iterators
returns an iterator to the beginning 
(public member function)
returns an iterator to the end 
(public member function)
returns a reverse iterator to the beginning 
(public member function)
returns a reverse iterator to the end 
(public member function)
Capacity
checks whether the container is empty 
(public member function)
returns the number of elements 
(public member function)
returns the maximum possible number of elements 
(public member function)
reserves storage 
(public member function)
returns the number of elements that can be held in currently allocated storage 
(public member function)
reduces memory usage by freeing unused memory 
(public member function)
Modifiers
clears the contents 
(public member function)
inserts elements 
(public member function)
(C++11)
constructs element in-place 
(public member function)
erases elements 
(public member function)
adds an element to the end 
(public member function)
constructs an element in-place at the end 
(public member function)
removes the last element 
(public member function)
changes the number of elements stored 
(public member function)
swaps the contents 
(public member function)

Non-member functions

lexicographically compares the values in the vector 
(function template)
specializes the std::swap algorithm 
(function template)


Refer : http://en.cppreference.com/w/cpp/container/vector

반응형

'IT > C, C++' 카테고리의 다른 글

[C/C++] std::memcpy Api Reference  (0) 2016.10.21
[C/C++] std::vector::erase() Reference  (0) 2016.10.21
[C/C++] XOR 연산자 '^'  (0) 2016.10.20
[DBUS] DBUS 설명 사이트 정보  (0) 2016.01.27
[GLib] IO Channels: GLib Reference Manual  (0) 2016.01.26