2013/7/17 Frédéric Bron <frederic.bron@m4x.org>
I have two tuples:
typedef boost::tuple<double, int, std::string> Key;
Key k1, k2;

I would like to get the tuple of the min values for each corresponding
value between k1 and k2:
Key min=Key(std::min(k1.get<0>(), k2.get<0>()), std::min(k1.get<1>(),
k2.get<1>()), std::min(k1.get<2>(), k2.get<2>()));

but I do not know the length of the tuple so I am looking for a
generic algorithm...
Is this possible with boost::fusion or boost::mpl?

Probably like this:

    struct min_functor
    {
        template<class T>
        T operator()(T const& a, T const& b) const
        {
            return std::min(a, b);
        }
    };

    auto ret = fusion::transform(k1, k2, min_functor());
    fusion::copy(ret, min);


HTH