Boost logo

Boost Users :

Subject: Re: [Boost-users] Elegant solution to interview question about boost::fusion::vector
From: Stuart (DerTopper_at_[hidden])
Date: 2013-03-29 14:21:44


> On 03/29/2013 09:43 AM, Stuart wrote:
>>
>> // Functor that extracts nth element of row vector.
>> template <unsigned N>
>> struct tuple_at
>> {
>> template <class Vector>
>> typename boost::fusion::result_of::at_c<const Vector,N>::type
>> operator()(Vector const& t) const
>> {
>> return boost::fusion::at_c<N, Vector>(t);
>> }
>> };
>>
>> <snip>
>>
>> However, I think that I should be able to achieve the same without the
>> template tuple_at.
>>
>> <snip>
>>

On 03/29/13 18:54, Steven Watanabe wrote:
> boost::phoenix::at_c<N>(boost::phoenix::placeholders::_1)
>
> In Christ,
> Steven Watanabe

Wow, many thanks!
Stuart


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