|
Boost Users : |
From: David Klein (dave_chp_at_[hidden])
Date: 2006-11-24 20:44:30
chun ping wang wrote:
> sorry i want to know how to insert them not to how to copy tehm .
> like Container of boost of array .
>
> vector<boost::array<int, 4> > v;
> v.push_back({4, 9, 11, 19});
this line: vector<int> v(a.begin(), a.end());
actually creates a vector with the data of the array.
the copy(...) line was just "a test" to show that the content of v
was 1, 2, 3, 4...
array<int, 4> a = {0, 1, 2, 3}; // create int array with values 0 ... 3
vector<int> v(a.begin(), a.end()); // create vector and copy values from
array to vector
the "blabla copy" line would be equal to
for (size_t loop = 0; loop < v.size(); ++loop)
{
cout << loop << "\n";
}
is this what you ment, or else i'm sorry, i'm missing your point?
-- regards, dave
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net