Elegant solution to interview question about boost::fusion::vector

Hello everyone,
I have stumbled over m2pq36bk97.fsf@boostpro.com in
comp.lang.c++.moderated. I had never used boost before but I always try
to solve interview questions. I found a solution that works, but I have
the feeling that there must be a more elegant solution.
The problem that was presented in the interview was the following:
typedef boost::fusion::vector

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
::type operator()(Vector const& t) const { return boost::fusion::at_c (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

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
::type operator()(Vector const& t) const { return boost::fusion::at_c (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
participants (2)
-
Steven Watanabe
-
Stuart