Boost logo

Boost Users :

Subject: Re: [Boost-users] iterator over boost::tuple
From: stephane GULLAUD (stephane.gullaud_at_[hidden])
Date: 2015-07-06 09:58:24


I think you'll want to look info boost fusion library for this. Since you
are working with heterogneous types, you'll probably need use a template
function to express what you want to do. Boost Phoenix should also help you
to create a polymorphic functor to apply to each element of the tuple.

Le lun. 6 juil. 2015 08:51, Gavin Lambert <gavinl_at_[hidden]> a écrit :

> On 6/07/2015 18:23, Uthpal Urubail wrote:
> > Experts,
> > What is the best way to iterator over boost::tuple and return value?
> > Example:
> > For(int i=0;i<boost::tuples::length<T>::value;i++)
> > {
> > Boost_tuple_example.get<i>();
> > }
>
> I think you'll need to explain more about why you're trying to do that.
>
> Tuples are typically related data of heterogeneous types, so it
> typically doesn't make sense (and nor is it possible without a common
> base class or type erasure) to return components individually in that
> sort of generic fashion. Unless I'm just misinterpreting your example.
>
>
> _______________________________________________
> 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