|
Boost Users : |
From: David Klein (dave_chp_at_[hidden])
Date: 2006-11-24 19:55:29
chun ping wang wrote:
> hi i would like to know how to insert boost::array into containers
> such as vectors, list, etc, in an effective and easy way.. tuples
> don't work cause you can't get to random access index. Thanks.
>
> AES word example.
> typedef boost::array<int, 4> word;
>
> std::vector vecOfWord;
>
> // perform some word insertion.
> ------------------------------------------------------------------------
>
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
#include <boost/array.hpp>
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using namespace boost;
int main( int argc, char * argv[] )
{
array<int, 5> a = {0, 1, 2, 3, 4};
vector<int> v(a.begin(), a.end());
copy(v.begin(), v.end(), ostream_iterator<int>(cout, "\n"));
return 0;
}
-- HTH 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