Boost logo

Boost Users :

Subject: Re: [Boost-users] [fusion] .at<N>() template member in containers?
From: michi7x7 (mailing-lists_at_[hidden])
Date: 2010-10-06 15:09:33


  Hi
> Besides possible redundancy, why is that the fusion containers, for
> example fusion::vector, doesn't have a template member function to
> extract elements?
what do you mean? .at<>() is a template member function.
> fusion::vector<double, int, std::string> stuff(1.2, 3, "hola");
> stuff.at<2>(); //returns "hola", just like at_c<2>(stuff);
at_c<N>() is from Boost.Spirit and uses .at<>() internally (i guess).
> Wouldn't it be more consistent with std::vector v, v[2] or v.at(2);
That's not possible, because the return-type has to be known during
compile-time. You can't do this with "normal" arguments.
> By the way, does anybody know where the name given "at_c" (I mean the
> '_c') comes from?
Well, I guess this is for "container" ?
> Thank you,
> Alfredo
Regards,

michi7x7


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