Boost logo

Boost Users :

Subject: Re: [Boost-users] Elegant solution to interview question about boost::fusion::vector
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2013-03-29 13:54:17


AMDG

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>
>

boost::phoenix::at_c<N>(boost::phoenix::placeholders::_1)

In Christ,
Steven Watanabe


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