Boost logo

Boost Users :

From: chun ping wang (cablepuff_at_[hidden])
Date: 2007-08-17 14:52:14


thanks.

So how would i repalce this using repeat.

for (int i = 0; i < 20; ++i)
   v.push_back(parser.value("titles[]", i));

or it does not seems to be possible.

On 8/17/07, Thorsten Ottosen <thorsten.ottosen_at_[hidden]> wrote:
>
> chun ping wang skrev:
> > Question 1.
> > std::vector<Roles> vr;
> > the constructor for Roles:
> > enum Role { .....};
> > explicit Roles (const std::string& usr, const Role& r);
> > How would I use boost::assign::list_of to assign a vector of Roles
> > instead of doing regular vector push_back.
>
> vr = list_of<Roles>( "foo", Role1 )( "bar", Role2 );
>
> > Question 2.
> > Related.
> > I have a Hash map i.e. boost::unordered_map<std::string,
> > compositionType> and i want to use boost::map_list_of how would i do
> that.
>
> Does the normal way for maps not work?
>
> > Question 3.
> > trying to use operator += in boost::assignment i get error specifying
> > unknown types.
> > typedef boost::function<std::vector<int>(std::vector<int>)> sortfunc;
> > std::vector<sortfunc> function_list;
> > // quicksort random
> > function_list += (&quicksort<QSTYPE(RANDOM), int, std::vector>)
> > // quicksort median
> > (&quicksort<QSTYPE(MEDIAN), int, std::vector>) // error here.
> > // quicksort mediantriple
> > (&quicksort<QSTYPE(MEDIANTRIPLE), int, std::vector>)
> > // merge sort
> > (&mergesort<int, std::vector>)
> > // heap sort
> > (&heapsort<int, std::vector>)
> > // selection sort
> > (&selection_sort<int, std::vector>)
> > // standard sort
> > (&standard_sort<int, std::vector>);
>
> operator += requires a comma-separated list IIRC.
>
> use push_back( function_list )(...)(...)
>
> -Thorsten
>
> _______________________________________________
> 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