Boost logo

Boost Users :

From: chun ping wang (cablepuff_at_[hidden])
Date: 2006-11-24 20:21:25


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});

On 11/24/06, David Klein <dave_chp_at_[hidden]> wrote:
>
> 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 mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>



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