cpp:stl:vector
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | Next revisionBoth sides next revision | ||
cpp:stl:vector [2020/05/27 16:24] – gthanos | cpp:stl:vector [2020/05/27 16:30] – [Ένθεση στον πίνακα] gthanos | ||
---|---|---|---|
Line 16: | Line 16: | ||
<code cpp vector_insert.cpp> | <code cpp vector_insert.cpp> | ||
+ | #include < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | using namespace std; | ||
+ | |||
+ | template< | ||
+ | void print(vector< | ||
+ | for(auto it = v.cbegin(); it!=v.cend(); | ||
+ | cout << setw(4) << *it; | ||
+ | cout << endl; | ||
+ | } | ||
+ | |||
+ | template< | ||
+ | void print_r(vector< | ||
+ | for(auto it = v.crbegin(); | ||
+ | cout << setw(4) << *it; | ||
+ | cout << endl; | ||
+ | } | ||
+ | |||
+ | int main() { | ||
+ | vector< | ||
+ | for(int i=0; i<10; i++) { | ||
+ | ints.push_back(i+1); | ||
+ | ints.insert(ints.begin(), | ||
+ | } | ||
+ | print(ints); | ||
+ | } | ||
</ | </ | ||
cpp/stl/vector.txt · Last modified: 2023/05/29 19:12 by gthanos