// @topic T061130 std::copy from array to std::vector // @brief copy algorithm demo and half-open range #include <iostream> #include <cstdlib> #include <string> #include <vector> #include <algorithm> int main() { int myarray[] = { 11, 22, 33, 44, 55 }; // [0] [1] [2] [3] [4] [5] // myarray + 0 +1 +4 +5 int * start = &myarray[ 0 ]; int * finish = &myarray[ 5 ]; std::vector< int > vect( 5 ); // create vector with 5 elements std::copy( myarray, myarray + 5, vect.begin() ); std::copy( start, finish, vect.begin() ); system("pause"); return 0; }